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

The Product CR doesn't syncronize changes after deleting the application plan object

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Major
    • None
    • 2.12.0 GA
    • 3scale Operator
    • False
    • None
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Hide

      1) Create a secret:

      oc create secret generic threescale-provider-account --from-literal=adminURL=https://<admin -portal-url> --from-literal=token=<token>
      

      2) Create a backend: backend1.yaml:

      apiVersion: capabilities.3scale.net/v1beta1
      kind: Backend
      metadata:
        name: backend1
      spec:
        name: "Operated Backend 1"
        systemName: "backend1"
        privateBaseURL: "https://echo-api.3scale.net"
      
      oc create -f backend1.yaml
      

      3) Product CRD with application plan: product1.yaml:

      apiVersion: capabilities.3scale.net/v1beta1
      kind: Product
      metadata:
        name: product1
      spec:
        name: "OperatedProduct 1"
        systemName: "operatedproduct1"
        backendUsages:
          backend1:
            path: /
        applicationPlans:
          plan01:
            name: "My Plan 01"
            setupFee: "14.56"
          plan02:
            name: "My Plan 02"
            trialPeriod: 3
            costMonth: 3
      
      oc create -f product1.yaml
      

      4) Create an application from the UI:
      Example:
      https://<admin-portal-url>/p/admin/applications/7

      5) Delete the application plan object from the product CR and reload the yaml file:
      The following error can be seen:

      status:
        conditions:
          - lastTransitionTime: '2022-07-29T12:34:49Z'
            message: >-
              Task failed SyncApplicationPlans: Error sync product [operatedproduct1]
              plans: product [operatedproduct1] delete applicationPlan: error calling
              3scale system - reason: {"errors":{"base":["This application plan cannot
              be deleted! At least one application depends on it."]}} - code: 403
      

      but the application plan doesn't appear any more in the product YAML file:

      spec:
        backendUsages:                =============> it should be here
          backend1:
            path: /
        metrics:
          hits:
            description: Number of API hits
            friendlyName: Hits
            unit: hit
        name: OperatedProduct 1
        policies:
          - configuration: {}
            enabled: true
            name: apicast
            version: builtin
        systemName: operatedproduct1
      status:
        conditions:
          - lastTransitionTime: '2022-07-29T12:34:49Z'
            message: >-
              Task failed SyncApplicationPlans: Error sync product [operatedproduct1]
              plans: product [operatedproduct1] delete applicationPlan: error calling
              3scale system - reason: {"errors":{"base":["This application plan cannot
              be deleted! At least one application depends on it."]}} - code: 403
            status: 'True'
      
      Show
      1) Create a secret: oc create secret generic threescale-provider-account --from-literal=adminURL=https: //<admin -portal-url> --from-literal=token=<token> 2) Create a backend: backend1.yaml: apiVersion: capabilities.3scale.net/v1beta1 kind: Backend metadata: name: backend1 spec: name: "Operated Backend 1" systemName: "backend1" privateBaseURL: "https: //echo-api.3scale.net" oc create -f backend1.yaml 3) Product CRD with application plan : product1.yaml: apiVersion: capabilities.3scale.net/v1beta1 kind: Product metadata: name: product1 spec: name: "OperatedProduct 1" systemName: "operatedproduct1" backendUsages: backend1: path: / applicationPlans: plan01: name: "My Plan 01" setupFee: "14.56" plan02: name: "My Plan 02" trialPeriod: 3 costMonth: 3 oc create -f product1.yaml 4) Create an application from the UI: Example: https://<admin-portal-url>/p/admin/applications/7 5) Delete the application plan object from the product CR and reload the yaml file: The following error can be seen: status: conditions: - lastTransitionTime: '2022-07-29T12:34:49Z' message: >- Task failed SyncApplicationPlans: Error sync product [operatedproduct1] plans: product [operatedproduct1] delete applicationPlan: error calling 3scale system - reason: { "errors" :{ "base" :["This application plan cannot be deleted! At least one application depends on it."]}} - code: 403 but the application plan doesn't appear any more in the product YAML file: spec: backendUsages: =============> it should be here backend1: path: / metrics: hits: description: Number of API hits friendlyName: Hits unit: hit name: OperatedProduct 1 policies: - configuration: {} enabled: true name: apicast version: builtin systemName: operatedproduct1 status: conditions: - lastTransitionTime: '2022-07-29T12:34:49Z' message: >- Task failed SyncApplicationPlans: Error sync product [operatedproduct1] plans: product [operatedproduct1] delete applicationPlan: error calling 3scale system - reason: { "errors" :{ "base" :["This application plan cannot be deleted! At least one application depends on it."]}} - code: 403 status: 'True'

    Description

      Current behaviour

      • A Product CR has one or more application plans under the spec, applicationPlans object.
      • An application has been created from the UI/API with one of the existing application plans created by the Product CR.
      • When deleting the applicationPlans object from the Product CR, the following error appears in the Product CR:

      status:
      conditions:

      • lastTransitionTime: '2022-07-29T12:34:49Z'
        message: >-
        Task failed SyncApplicationPlans: Error sync product [operatedproduct1]
        plans: product [operatedproduct1] delete applicationPlan: error calling
        3scale system - reason: {"errors":{"base":["This application plan cannot
        be deleted! At least one application depends on it."]}} - code: 403

      which is expected since there is an application that is binded to the plan.

      • However, when refreshing the Product CR yaml file, the object applicationPlans has been deleted and the application plans can be seen in the admin portal UI.
        spec:
          backendUsages:
            backend1:
              path: /
          metrics:
            hits:
              description: Number of API hits
              friendlyName: Hits
              unit: hit
          name: OperatedProduct 1
          policies:
            - configuration: {}
              enabled: true
              name: apicast
              version: builtin
          systemName: operatedproduct1
        status:
        

      *Expected behaviour: *
      After refreshing the Product CR yaml file, because the application plans have not been deleted the applicationPlans object should not be deleted from the Product CR yaml file:

      spec:
        name: "OperatedProduct 1"
        systemName: "operatedproduct1"
        backendUsages:
          backend1:
            path: /
        applicationPlans:
          plan01:
            name: "My Plan 01"
            setupFee: "14.56"
          plan02:
            name: "My Plan 02"
            trialPeriod: 3
            costMonth: 3
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            rhn-support-avilatus Anna Vila Tusell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: