arabot777 opened a new issue #604:
URL: https://github.com/apache/apisix-ingress-controller/issues/604


   ### Issue description
   Two questions.
   #### The first question is bug,  CRD resources and API object are different 
from timeount unit definitions.
   In CRD resources, passive healthy check timeout is set to **`string`**. In 
api, passive healthy check timeout is set to **`time.Duration`**. However In 
CRD resources, active healthy check timeout is set to **`number`** and in api 
is set to **`time.Duration`**.
   This leads to unable to declare  unhealthy timeout.
   
https://github.com/apache/apisix-ingress-controller/blob/2d12c3fdd1369e9e263342d0def6473de5c0664f/samples/deploy/crd/v1beta1/ApisixUpstream.yaml#L341-L342
   
https://github.com/apache/apisix-ingress-controller/blob/2d12c3fdd1369e9e263342d0def6473de5c0664f/pkg/kube/apisix/apis/config/v1/types.go#L218-L222
   
   
   #### The second question is suggestion.After testing, the timeout unit of 
the active health check is nanosecond instead of the second or milliseconds 
used frequently.This is still a little inconvenient for normal use.
   Few people think that the unit is nanosecond, or you can mark it in the 
document.
   If I want to define timeout for 5s, I need to do this.It is so big:
   
   > ```
   > apiVersion: apisix.apache.org/v1
   > kind: ApisixUpstream
   > metadata:
   >   name: httpbin
   > spec:
   >   healthCheck:
   >     active:
   >       type: http
   >       httpPath: /status/200
   >       timeout: 5000000000
   >       healthy:
   >         httpCodes: [200]
   >         interval: 1s
   >       unhealthy:
   >         httpFailures: 20
   >         interval: 1s
   > ```
   
   
   
   ### Environment
   
   apisix-ingress-controller version:
   Version: 0.6.0
   Git SHA: no-git-module
   Go Version: go1.13.8
   Building OS/Arch: linux/amd64
   Running OS/Arch: linux/amd64
   
   Kubernetes cluster version:
   Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4", 
GitCommit:"d360454c9bcd1634cf4cc52d1867af5491dc9c5f", GitTreeState:"clean", 
BuildDate:"2020-11-12T01:09:16Z", GoVersion:"go1.15.4", Compiler:"gc", 
Platform:"darwin/amd64"}
   Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.2", 
GitCommit:"faecb196815e248d3ecfb03c680a4507229c2a56", GitTreeState:"clean", 
BuildDate:"2021-01-13T13:20:00Z", GoVersion:"go1.15.5", Compiler:"gc", 
Platform:"linux/amd64"}
   ### Minimal test code / Steps to reproduce the issue
   About the first question:
   1. If I am defined as int, it will report an error
   > ```
   > apiVersion: apisix.apache.org/v1
   > kind: ApisixUpstream
   > metadata:
   >   name: httpbin
   > spec:
   >   healthCheck:
   >     active:
   >       type: http
   >       httpPath: /status/200
   >       timeout: 5000000000
   >       healthy:
   >         httpCodes: [200]
   >         interval: 1s
   >       unhealthy:
   >         httpFailures: 20
   >         interval: 1s
   >     passive:
   >       type: http
   >       healthy:
   >         httpCodes: [200]
   >         successes: 20
   >       unhealthy:
   >         httpCodes: [502]
   >         httpFailures: 20
   >         tcpFailures: 20
   >         timeout: 5
   > ```
   
   the error logs :
   `The ApisixUpstream "httpbin" is invalid: 
spec.healthCheck.passive.unhealthy.timeout: Invalid value: "integer": 
spec.healthCheck.passive.unhealthy.timeout in body must be of type string: 
"integer"`
   
   2.If I am defined as string, it can't take effect
   > ```
   > apiVersion: apisix.apache.org/v1
   > kind: ApisixUpstream
   > metadata:
   >   name: httpbin
   > spec:
   >   healthCheck:
   >     active:
   >       type: http
   >       httpPath: /status/200
   >       timeout: 5000000000
   >       healthy:
   >         httpCodes: [200]
   >         interval: 1s
   >       unhealthy:
   >         httpFailures: 20
   >         interval: 1s
   >     passive:
   >       type: http
   >       healthy:
   >         httpCodes: [200]
   >         successes: 20
   >       unhealthy:
   >         httpCodes: [502]
   >         httpFailures: 20
   >         tcpFailures: 20
   >         timeout: '15'
   > ```
   
![image](https://user-images.githubusercontent.com/30978207/126453749-e1db3e17-1fe6-4477-91b1-22e65659823d.png)
   
   
   ### What's the actual result? (including assertion message & call stack if 
applicable)
   
   ### What's the expected result?
   Unified time unit definition, and inform the default unit


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to