tmforum-oda / oda-canvas

Apache License 2.0
19 stars 53 forks source link

operator: Cleanup - Use ExposedAPI instead of API in all relevant operators #266

Open LesterThomas opened 3 months ago

LesterThomas commented 3 months ago

Description

For managing the configuration of API Gateways, the Canvas originally had just one API custom resource. Since then we introduced a DependentAPI resource and chose to rename API to ExposedAPI. This issue is to clean-up remaining operators to that we only use ExposedAPI or DependentAPI.

LesterThomas commented 3 months ago

@RJ-acc - I noticed in the old API CRD , the properties include apitype (lowercase) and that someone has put a comment in the ExposedAPI operator to propose this should be apiType (camelCase). As part of this change, we should adopt the camelCase version apiType.

RJ-acc commented 3 months ago

Hi @LesterThomas @brian-burton , Yes due to this component operator unable to create CR with kind - ExposedAPI and throw errors, . Some sample error which i observed are below.

[2024-07-24 07:48:34,280] ComponentOperator [WARNING ] [r4-productcatalogmanagement|component/r4-productcatalogmanagement|coreAPIs|createAPIResource] API Exception creating: (422) Reason: Unprocessable Entity HTTP response headers: HTTPHeaderDict({'Audit-Id': '050bcabd-df73-41ca-931b-ca0c0409d309', 'Cache-Control': 'no-cache, private', 'Content-Type': 'application/json', 'X-Kubernetes-Pf-Flowschema-Uid': '029b22b2-971d-4bb5-ae09-5c45f4146078', 'X-Kubernetes-Pf-Prioritylevel-Uid': 'ae41dcef-da75-490f-ba4d-2c8b9355f347', 'Date': 'Wed, 24 Jul 2024 07:48:34 GMT', 'Content-Length': '449'}) HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"ExposedAPI.oda.tmforum.org \"r4-productcatalogmanagement-productcatalogmanagement\" is invalid: spec.apiType: Required value","reason":"Invalid","details":{"name":"r4-productcatalogmanagement-productcatalogmanagement","group":"oda.tmforum.org","kind":"ExposedAPI","causes":[{"reason":"FieldValueRequired","message":"Required value","field":"spec.apiType"}]},"code":422} , but this alone will not rectify issue ,i think we need to change in component CRD as well. Currently it is apitype in component crd so working fine when creating API but if we change to ExposedAPI we need to change that to apiType as well.

LesterThomas commented 1 week ago

This has been updated in all the controllers. The remaining tidy-up is to remove the legacy API CRD at /oda-canvas/charts/oda-crds/templates/oda-api-crd.yaml