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

Update the operator docs for product mappingRules

XMLWordPrintable

    • False
    • None
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started

      What

      the product-reference.md seems to be suggesting that metricMethodRef is an object
      https://github.com/3scale/3scale-operator/blob/master/doc/product-reference.md#metricmethodrefspec
      Where as if you try and implement this you will see the following error

      oc apply -f - <<EOF
      ---
      apiVersion: capabilities.3scale.net/v1beta1
      kind: Product
      metadata:
        name: product1-cr
        namespace: 3scale-test
      spec:
        applicationPlans:
          plan01:
            name: "My Plan 01"
            limits:
              - period: month
                value: 300
                metricMethodRef:
                  systemName: hits
                  backend: backend1
        name: product1
        backendUsages:
          backend1:
            path: /
        mappingRules:
          - httpMethod: GET
            pattern : "/"
            metricMethodRef:
              systemName: hits
              backend: backend1
            increment: 1
          - httpMethod: POST
            pattern : "/"
            metricMethodRef:
              systemName: hits
              backend: backend1
            increment: 1    
      EOF
      The Product "product1-cr" is invalid: 
      * spec.mappingRules[0].metricMethodRef: Invalid value: "object": spec.mappingRules[0].metricMethodRef in body must be of type string: "object"
      * spec.mappingRules[1].metricMethodRef: Invalid value: "object": spec.mappingRules[1].metricMethodRef in body must be of type string: "object"
      

      How

      As outline above error the operator is expecting a string not an object

       - httpMethod: POST
            pattern : "/"
            metricMethodRef: hits
            increment: 1    
      

      As backend also have mappingRule.metricMethodRef we should document product in a similar fashion https://github.com/3scale/3scale-operator/blob/master/doc/backend-reference.md#mappingrulespec

      Update the product-reference.md docs
      NOTE: metricMethodRef is used in more that just mapping rules so may be some inconsistancy in how its documented i.e. you can also use this in product applicationplans

      spec: 
        applicationPlans: 
          plan01:
            name: "My Plan 01"
            limits: 
              - period: month
                value: 300
                metricMethodRef: 
                  systemName: hits
                  backend: backend1
      

      and this works without issue, may need further investigation.

      Agreement here that the scope of this work should just be a documentation change

            Unassigned Unassigned
            aucunnin@redhat.com Austin Cunningham
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: