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

Update Product/Backend status field on spec validation fail

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • 3scale Operator
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started

      When there is a product or backend CR's spec validation or external reference validation error, CR status is not updated

      For example, duplicated metric system name spec error:

       

      apiVersion: capabilities.3scale.net/v1beta1                              
      kind: Product                                                            
      metadata:                                                                
        name: product1                                                         
      spec:                                                                    
        name: "OperatedProduct 1"                                              
        metrics:                                                               
          metric01:                                                            
            friendlyName: Metric01                                             
            unit: "1"                                                          
          hits:                                                                
            description: Number of API hits                                    
            friendlyName: Hits                                                 
            unit: "hit"                                                        
        methods:                                                               
          metric01:                                                            
            friendlyName: Method01                                             
      

       

      The 3scale operator detects error and generates event and logs the error. But it does not update status.

       

      The resulting product CR:

       apiVersion: capabilities.3scale.net/v1beta1
      kind: Product
      metadata:
        annotations:
          kubectl.kubernetes.io/last-applied-configuration: |
            {"apiVersion":"capabilities.3scale.net/v1beta1","kind":"Product","metadata":{"annotations":{},"name":"product1","namespace":"caps"},"spec":{"methods":{"metric01":{"friendlyName":"Method01"}},"metrics":{"hits":{"description":"Number of API hits","friendlyName":"Hits","
      unit":"hit"},"metric01":{"friendlyName":"Metric01","unit":"1"}},"name":"OperatedProduct 1"}}
        creationTimestamp: "2020-08-31T14:54:09Z"
        generation: 2
        name: product1
        namespace: caps
        resourceVersion: "161084022"
        selfLink: /apis/capabilities.3scale.net/v1beta1/namespaces/caps/products/product1
        uid: f3babacd-0324-4788-896f-76b7cfa34e84
      spec:
        methods:
          metric01:
            friendlyName: Method01
        metrics:
          hits:
            description: Number of API hits
            friendlyName: Hits
            unit: hit
          metric01:
            friendlyName: Metric01
            unit: "1"
        name: OperatedProduct 1
        systemName: operatedproduct1
      

       

      Operator's log:

      2020-08-31T16:54:10.133+0200	INFO	controller_product	ERROR	{"product": "product1", "spec validation error": "spec.methods[metric01]: Invalid value: v1beta1.MethodSpec{Name:\"Method01\", Description:\"\"}: method system_name not unique."
       

       

              Unassigned Unassigned
              eguzki Eguzki Astiz Lezaun
              Martin Kudlej Martin Kudlej
              Eguzki Astiz Lezaun Eguzki Astiz Lezaun
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: