Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-11274

The operator doesn't delete the objects in the correct order

XMLWordPrintable

    • 2
    • False
    • None
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Hide

        1. Create a simple Product CR with the following mapping rules and methods:

      mappingRules:
          - httpMethod: GET
            increment: 1
            last: false
            metricMethodRef: api1
            pattern: /v1/api1
          - httpMethod: GET
            increment: 1
            last: false
            metricMethodRef: api2
            pattern: /v1/api2
        methods:
          api1:
            description: api1
            friendlyName: Get api1
          api2:
            description: api2
            friendlyName: Get api2
      

      2. Update the configuration to staging
      3. Then from the Product CR delete at the same time the 2 objects (mapping rule + method)

      httpMethod: GET
      increment: 1
      last: false
      metricMethodRef: api2
      pattern: /v1/api2
      
       api2:
         description: api2
         friendlyName: Get api2
      

      4. The Product sync will fail with the error:

      Task failed SyncMethods: Error sync product methods [apitest]: product [apitest] delete method: error calling 3scale system - reason: \{"errors":{"base":["Method is used by the latest gateway configuration and cannot be deleted"]}} - code: 403
      

       

      Show
        1. Create a simple Product CR with the following mapping rules and methods: mappingRules: - httpMethod: GET increment: 1 last: false metricMethodRef: api1 pattern: /v1/api1 - httpMethod: GET increment: 1 last: false metricMethodRef: api2 pattern: /v1/api2 methods: api1: description: api1 friendlyName: Get api1 api2: description: api2 friendlyName: Get api2 2. Update the configuration to staging 3. Then from the Product CR delete at the same time the 2 objects (mapping rule + method) httpMethod: GET increment: 1 last: false metricMethodRef: api2 pattern: /v1/api2 api2: description: api2 friendlyName: Get api2 4. The Product sync will fail with the error: Task failed SyncMethods: Error sync product methods [apitest]: product [apitest] delete method: error calling 3scale system - reason: \{"errors":{"base":["Method is used by the latest gateway configuration and cannot be deleted"]}} - code: 403  

      Current behavior
      When deleting 2 objects from the Product CR yaml file at the same time:

      • a mapping rule
      • a method which is bound to the mapping rule and it is not used by other mapping rules

      the Product fails to sync with the following error:

      ask failed SyncMethods: Error sync product methods [apitest]: product [apitest] delete method: error calling 3scale system - reason: {"errors":{"base":["Method is used by the latest gateway configuration and cannot be deleted"]}} - code: 403
      

      It seems the operator is trying to delete the method before the mapping rule and therefore results in an error.

      • If you delete the mapping rule and leave the method in the Product CR, the sync is OK.
      • If you delete the method and leave the mapping rule, the sync fails with the error: mappingrule does not have valid metric or method reference.
      • However if you delete both objects mapping rule and method at the same time from the yaml file, there is a conflict. The operator should delete first the mapping rule and then the method.

      Expected behavior
      The user should be able to delete both objects at once from the Product CR and the operator perform the delete operations with the correct order (delete mapping rule first).

              Unassigned Unassigned
              rhn-support-avilatus Anna Vila Tusell
              Martin Kudlej Martin Kudlej
              Valery Mogilevsky Valery Mogilevsky
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: