This is an automated email from the ASF dual-hosted git repository.

kvn pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-ingress-controller.git


The following commit(s) were added to refs/heads/master by this push:
     new 6d8eb7e  chore: add schema for ApisixUpstream (#407)
6d8eb7e is described below

commit 6d8eb7e42970f03cc3f5306cf76b8671940c002f
Author: Alex Zhang <zchao1...@gmail.com>
AuthorDate: Wed May 5 21:58:38 2021 +0800

    chore: add schema for ApisixUpstream (#407)
    
    * chore: add schema for ApisixUpstream
    
    * fix
---
 samples/deploy/crd/v1beta1/ApisixUpstream.yaml | 339 +++++++++++++++++++++++++
 test/e2e/features/healthcheck.go               |   6 +-
 2 files changed, 342 insertions(+), 3 deletions(-)

diff --git a/samples/deploy/crd/v1beta1/ApisixUpstream.yaml 
b/samples/deploy/crd/v1beta1/ApisixUpstream.yaml
index 8091cff..c877934 100644
--- a/samples/deploy/crd/v1beta1/ApisixUpstream.yaml
+++ b/samples/deploy/crd/v1beta1/ApisixUpstream.yaml
@@ -32,3 +32,342 @@ spec:
     kind: ApisixUpstream
     shortNames:
       - au
+  preserveUnknownFields: false
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            loadbalancer:
+              type: object
+              properties:
+                type:
+                  type: string
+                  enum:
+                    - roundrobin
+                    - chash
+                    - ewma
+                    - least_conn
+                hashOn:
+                  type: string
+                  enum:
+                    - vars
+                    - vars_combinations
+                    - header
+                    - cookie
+                    - consumer
+                key:
+                  type: string
+              required:
+                - type
+            scheme:
+              type: string
+              enum:
+                - http
+                - grpc
+            retries:
+              type: integer
+              minimum: 0
+            timeout:
+              type: object
+              properties:
+                connect:
+                  type: string
+                read:
+                  type: string
+                send:
+                  type: string
+            healthCheck:
+              type: object
+              anyOf:
+                - required:
+                    - active
+                - required:
+                    - active
+                    - passive
+              properties:
+                active:
+                  type: object
+                  properties:
+                    type:
+                      type: string
+                      enum:
+                        - http
+                        - https
+                        - tcp
+                    timeout:
+                      type: number
+                      minimum: 0
+                    concurrency:
+                      type: integer
+                      minimum: 1
+                    host:
+                      type: string
+                      pattern: "^\\*?[0-9a-zA-Z-._]+$"
+                    port:
+                      type: integer
+                      minimum: 1
+                      maximum: 65535
+                    httpPath:
+                      type: string
+                      minLength: 1
+                    strictTLS:
+                      type: boolean
+                    requestHeaders:
+                      type: array
+                      minItems: 1
+                      items:
+                        type: string
+                    healthy:
+                      type: object
+                      properties:
+                        interval:
+                          type: string
+                        httpCodes:
+                          type: array
+                          minItems: 1
+                          items:
+                            type: integer
+                            minimum: 200
+                            maximum: 599
+                        successes:
+                          type: integer
+                          minimum: 1
+                          maximum: 254
+                    unhealthy:
+                      type: object
+                      properties:
+                        interval:
+                          type: string
+                        httpCodes:
+                          type: array
+                          minItems: 1
+                          items:
+                            type: integer
+                            minimum: 200
+                            maximum: 599
+                        httpFailures:
+                          type: integer
+                          minimum: 1
+                          maximum: 254
+                        tcpFailures:
+                          type: integer
+                          minimum: 1
+                          maximum: 254
+                        timeout:
+                          type: string
+                passive:
+                  type: object
+                  properties:
+                    type:
+                      type: string
+                      enum:
+                        - http
+                        - https
+                        - tcp
+                    healthy:
+                      type: object
+                      properties:
+                        httpCodes:
+                          type: array
+                          minItems: 1
+                          items:
+                            type: integer
+                            minimum: 200
+                            maximum: 599
+                        successes:
+                          type: integer
+                          minimum: 1
+                          maximum: 254
+                    unhealthy:
+                      type: object
+                      properties:
+                        httpCodes:
+                          type: array
+                          minItems: 1
+                          items:
+                            type: integer
+                            minimum: 200
+                            maximum: 599
+                        httpFailures:
+                          type: integer
+                          minimum: 1
+                          maximum: 254
+                        tcpFailures:
+                          type: integer
+                          minimum: 1
+                          maximum: 254
+                        timeout:
+                          type: string
+            portLevelSettings:
+              type: array
+              items:
+                type: object
+                properties:
+                  port:
+                    type: integer
+                    minimum: 1
+                    maximum: 65535
+                  loadbalancer:
+                    type: object
+                    properties:
+                      type:
+                        type: string
+                        enum:
+                          - roundrobin
+                          - chash
+                          - ewma
+                          - least_conn
+                      hashOn:
+                        type: string
+                        enum:
+                          - vars
+                          - vars_combinations
+                          - header
+                          - cookie
+                          - consumer
+                      key:
+                        type: string
+                    required:
+                      - type
+                  scheme:
+                    type: string
+                    enum:
+                      - http
+                      - grpc
+                  retries:
+                    type: integer
+                    minimum: 0
+                  timeout:
+                    type: object
+                    properties:
+                      connect:
+                        type: string
+                      read:
+                        type: string
+                      send:
+                        type: string
+                  healthCheck:
+                    type: object
+                    anyOf:
+                      - required:
+                          - active
+                      - required:
+                          - active
+                          - passive
+                    properties:
+                      active:
+                        type: object
+                        properties:
+                          type:
+                            type: string
+                            enum:
+                              - http
+                              - https
+                              - tcp
+                          timeout:
+                            type: number
+                            minimum: 0
+                          concurrency:
+                            type: integer
+                            minimum: 1
+                          host:
+                            type: string
+                            pattern: "^\\*?[0-9a-zA-Z-._]+$"
+                          port:
+                            type: integer
+                            minimum: 1
+                            maximum: 65535
+                          httpPath:
+                            type: string
+                            minLength: 1
+                          strictTLS:
+                            type: boolean
+                          requestHeaders:
+                            type: array
+                            minItems: 1
+                            items:
+                              type: string
+                          healthy:
+                            type: object
+                            properties:
+                              interval:
+                                type: string
+                              httpCodes:
+                                type: array
+                                minItems: 1
+                                items:
+                                  type: integer
+                                  minimum: 200
+                                  maximum: 599
+                              successes:
+                                type: integer
+                                minimum: 1
+                                maximum: 254
+                          unhealthy:
+                            type: object
+                            properties:
+                              interval:
+                                type: string
+                              httpCodes:
+                                type: array
+                                minItems: 1
+                                items:
+                                  type: integer
+                                  minimum: 200
+                                  maximum: 599
+                              httpFailures:
+                                type: integer
+                                minimum: 1
+                                maximum: 254
+                              tcpFailures:
+                                type: integer
+                                minimum: 1
+                                maximum: 254
+                              timeout:
+                                type: string
+                      passive:
+                        type: object
+                        properties:
+                          type:
+                            type: string
+                            enum:
+                              - http
+                              - https
+                              - tcp
+                          healthy:
+                            type: object
+                            properties:
+                              httpCodes:
+                                type: array
+                                minItems: 1
+                                items:
+                                  type: integer
+                                  minimum: 200
+                                  maximum: 599
+                              successes:
+                                type: integer
+                                minimum: 1
+                                maximum: 254
+                          unhealthy:
+                            type: object
+                            properties:
+                              httpCodes:
+                                type: array
+                                minItems: 1
+                                items:
+                                  type: integer
+                                  minimum: 200
+                                  maximum: 599
+                              httpFailures:
+                                type: integer
+                                minimum: 1
+                                maximum: 254
+                              tcpFailures:
+                                type: integer
+                                minimum: 1
+                                maximum: 254
+                              timeout:
+                                type: string
diff --git a/test/e2e/features/healthcheck.go b/test/e2e/features/healthcheck.go
index 2751096..75c11cd 100644
--- a/test/e2e/features/healthcheck.go
+++ b/test/e2e/features/healthcheck.go
@@ -41,9 +41,9 @@ spec:
       httpPath: /status/502
       healthy:
         httpCodes: [200]
-        httpFailures: 2
         interval: 1s
       unhealthy:
+        httpFailures: 2
         interval: 1s
 `, backendSvc)
                err := s.CreateResourceFromString(au)
@@ -75,7 +75,7 @@ spec:
                assert.Equal(ginkgo.GinkgoT(), 
ups[0].Checks.Active.Healthy.Interval, 1)
                assert.Equal(ginkgo.GinkgoT(), 
ups[0].Checks.Active.Healthy.HTTPStatuses, []int{200})
                assert.Equal(ginkgo.GinkgoT(), 
ups[0].Checks.Active.Unhealthy.Interval, 1)
-               assert.Equal(ginkgo.GinkgoT(), 
ups[0].Checks.Active.Unhealthy.Interval, 1)
+               assert.Equal(ginkgo.GinkgoT(), 
ups[0].Checks.Active.Unhealthy.HTTPFailures, 2)
 
                // It's difficult to test healthchecker since we cannot let 
partial httpbin endpoints
                // down, if all of them are down, apisix in turn uses all of 
them.
@@ -96,9 +96,9 @@ spec:
       httpPath: /status/200
       healthy:
         httpCodes: [200]
-        httpFailures: 2
         interval: 1s
       unhealthy:
+        httpFailures: 2
         interval: 1s
     passive:
       healthy:

Reply via email to