You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/04/06 09:15:41 UTC

[GitHub] [apisix-ingress-controller] tokers opened a new pull request #345: feat: schema for apisixroute

tokers opened a new pull request #345:
URL: https://github.com/apache/apisix-ingress-controller/pull/345


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [ ] Bugfix
   - [ ] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   - Related issues
   
   ___
   ### Bugfix
   - Description
   
   - How to fix?
   
   ___
   ### New feature or improvement
   - Describe the details and related test reports.
   
   ___
   ### Backport patches
   - Why need to backport?
   
   - Source branch
   
   - Related commits and pull requests
   
   - Target branch
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] codecov-io commented on pull request #345: feat: schema for apisixroute

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #345:
URL: https://github.com/apache/apisix-ingress-controller/pull/345#issuecomment-813968906


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=h1) Report
   > Merging [#345](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=desc) (044035d) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/456efa6836e3195cc0fcb6603fb9243c1033860a?el=desc) (456efa6) will **decrease** coverage by `0.48%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #345      +/-   ##
   ==========================================
   - Coverage   43.84%   43.36%   -0.49%     
   ==========================================
     Files          40       39       -1     
     Lines        3435     3434       -1     
   ==========================================
   - Hits         1506     1489      -17     
   - Misses       1761     1775      +14     
   - Partials      168      170       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [pkg/apisix/cluster.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345/diff?src=pr&el=tree#diff-cGtnL2FwaXNpeC9jbHVzdGVyLmdv) | `28.44% <0.00%> (-5.97%)` | :arrow_down: |
   | [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345/diff?src=pr&el=tree#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `43.47% <0.00%> (-1.87%)` | :arrow_down: |
   | [test/e2e/e2e.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345/diff?src=pr&el=tree#diff-dGVzdC9lMmUvZTJlLmdv) | | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=footer). Last update [456efa6...044035d](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] codecov-io edited a comment on pull request #345: feat: schema for apisixroute

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #345:
URL: https://github.com/apache/apisix-ingress-controller/pull/345#issuecomment-813968906


   # [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=h1) Report
   > Merging [#345](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=desc) (6cc3e99) into [master](https://codecov.io/gh/apache/apisix-ingress-controller/commit/456efa6836e3195cc0fcb6603fb9243c1033860a?el=desc) (456efa6) will **decrease** coverage by `0.34%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345/graphs/tree.svg?width=650&height=150&src=pr&token=WPLQXPY3V0)](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #345      +/-   ##
   ==========================================
   - Coverage   43.84%   43.50%   -0.35%     
   ==========================================
     Files          40       39       -1     
     Lines        3435     3455      +20     
   ==========================================
   - Hits         1506     1503       -3     
   - Misses       1761     1781      +20     
   - Partials      168      171       +3     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [pkg/apisix/cluster.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345/diff?src=pr&el=tree#diff-cGtnL2FwaXNpeC9jbHVzdGVyLmdv) | `28.44% <0.00%> (-5.97%)` | :arrow_down: |
   | [pkg/kube/translation/apisix\_route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345/diff?src=pr&el=tree#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vYXBpc2l4X3JvdXRlLmdv) | `46.08% <0.00%> (-1.29%)` | :arrow_down: |
   | [pkg/apisix/route.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345/diff?src=pr&el=tree#diff-cGtnL2FwaXNpeC9yb3V0ZS5nbw==) | `44.84% <0.00%> (-0.50%)` | :arrow_down: |
   | [pkg/kube/translation/util.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345/diff?src=pr&el=tree#diff-cGtnL2t1YmUvdHJhbnNsYXRpb24vdXRpbC5nbw==) | `100.00% <0.00%> (ø)` | |
   | [test/e2e/e2e.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345/diff?src=pr&el=tree#diff-dGVzdC9lMmUvZTJlLmdv) | | |
   | [pkg/apisix/resource.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345/diff?src=pr&el=tree#diff-cGtnL2FwaXNpeC9yZXNvdXJjZS5nbw==) | `78.64% <0.00%> (+0.20%)` | :arrow_up: |
   | [pkg/apisix/upstream.go](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345/diff?src=pr&el=tree#diff-cGtnL2FwaXNpeC91cHN0cmVhbS5nbw==) | `48.04% <0.00%> (+1.18%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=footer). Last update [456efa6...6cc3e99](https://codecov.io/gh/apache/apisix-ingress-controller/pull/345?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] tokers commented on a change in pull request #345: feat: schema for apisixroute

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #345:
URL: https://github.com/apache/apisix-ingress-controller/pull/345#discussion_r610451502



##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: false
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]

Review comment:
       I grouped them by their meanings.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] tokers merged pull request #345: feat: schema for apisixroute

Posted by GitBox <gi...@apache.org>.
tokers merged pull request #345:
URL: https://github.com/apache/apisix-ingress-controller/pull/345


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] jbampton commented on a change in pull request #345: feat: schema for apisixroute

Posted by GitBox <gi...@apache.org>.
jbampton commented on a change in pull request #345:
URL: https://github.com/apache/apisix-ingress-controller/pull/345#discussion_r610429261



##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: false
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"
+                      hosts:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^\\*?[0-9a-zA-Z-._]+$"
+                      methods:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          enum: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"]
+                      remoteAddrs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                      exprs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: object
+                          properties:
+                            subject:
+                              type: object
+                              properties:
+                                scope:
+                                  type: string
+                                  enum: ["Header", "Query", "Cookie", "Path"]

Review comment:
       Should enums be sorted consistently the same way in each file ?
   
   ```suggestion
                                     enum: ["Cookie", "Header", "Path", "Query"]
   ```

##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: false
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"
+                      hosts:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^\\*?[0-9a-zA-Z-._]+$"
+                      methods:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          enum: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"]
+                      remoteAddrs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                      exprs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: object
+                          properties:
+                            subject:
+                              type: object
+                              properties:
+                                scope:
+                                  type: string
+                                  enum: ["Header", "Query", "Cookie", "Path"]
+                                name:
+                                  type: string
+                                  minLength: 1
+                              required:
+                              - scope
+                            op:
+                              type: string
+                              enum:
+                                - Equal
+                                - NotEqual
+                                - GreaterThan
+                                - LessThan
+                                - In
+                                - NotIn
+                                - RegexMatch

Review comment:
       So for this enum maybe keep the top part with the custom order and then for the bottom part sort it ?
   
   ```suggestion
   - RegexMatch
   - RegexMatchCaseInsensitive
   - RegexNotMatch
   - RegexNotMatchCaseInsensitive
   ```

##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: false
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]

Review comment:
       ```suggestion
                     - required: ["backend", "match", "name"]
   ```

##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: false
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"
+                      hosts:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^\\*?[0-9a-zA-Z-._]+$"
+                      methods:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          enum: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"]

Review comment:
       Whilst "GET" and "POST" are probably the most used or probably the most well known, should an enum array or list have a sort order or be random ?
   
   ```suggestion
                             enum: ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "TRACE"]
   ```

##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: false
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"
+                      hosts:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^\\*?[0-9a-zA-Z-._]+$"
+                      methods:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          enum: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"]
+                      remoteAddrs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                      exprs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: object
+                          properties:
+                            subject:
+                              type: object
+                              properties:
+                                scope:
+                                  type: string
+                                  enum: ["Header", "Query", "Cookie", "Path"]
+                                name:
+                                  type: string
+                                  minLength: 1
+                              required:
+                              - scope
+                            op:
+                              type: string
+                              enum:

Review comment:
       Should we sort enums ?  Or at least sort some part of the enums ?

##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: false
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]

Review comment:
       ```suggestion
                     - required: ["backends", "match", "name"]
   ```

##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: false
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"
+                      hosts:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^\\*?[0-9a-zA-Z-._]+$"
+                      methods:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          enum: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"]
+                      remoteAddrs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                      exprs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: object
+                          properties:
+                            subject:
+                              type: object
+                              properties:
+                                scope:
+                                  type: string
+                                  enum: ["Header", "Query", "Cookie", "Path"]
+                                name:
+                                  type: string
+                                  minLength: 1
+                              required:
+                              - scope
+                            op:
+                              type: string
+                              enum:
+                                - Equal
+                                - NotEqual
+                                - GreaterThan
+                                - LessThan
+                                - In
+                                - NotIn
+                                - RegexMatch
+                                - RegexNotMatch
+                                - RegexMatchCaseInsensitive
+                                - RegexNotMatchCaseInsensitive
+                            value:
+                              type: string
+                            set:
+                              type: array
+                              items:
+                                type: string
+                          oneOf:
+                            - required: ["subject", "op", "value"]

Review comment:
       ```suggestion
                               - required: ["op", "subject", "value"]
   ```

##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: false
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"
+                      hosts:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^\\*?[0-9a-zA-Z-._]+$"
+                      methods:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          enum: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"]
+                      remoteAddrs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                      exprs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: object
+                          properties:
+                            subject:
+                              type: object
+                              properties:
+                                scope:
+                                  type: string
+                                  enum: ["Header", "Query", "Cookie", "Path"]
+                                name:
+                                  type: string
+                                  minLength: 1
+                              required:
+                              - scope
+                            op:
+                              type: string
+                              enum:
+                                - Equal
+                                - NotEqual
+                                - GreaterThan
+                                - LessThan
+                                - In
+                                - NotIn
+                                - RegexMatch
+                                - RegexNotMatch
+                                - RegexMatchCaseInsensitive
+                                - RegexNotMatchCaseInsensitive
+                            value:
+                              type: string
+                            set:
+                              type: array
+                              items:
+                                type: string
+                          oneOf:
+                            - required: ["subject", "op", "value"]
+                            - required: ["subject", "op", "set"]

Review comment:
       ```suggestion
                               - required: ["op", "set", "subject"]
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] tokers commented on pull request #345: feat: schema for apisixroute

Posted by GitBox <gi...@apache.org>.
tokers commented on pull request #345:
URL: https://github.com/apache/apisix-ingress-controller/pull/345#issuecomment-816523982


   @jbampton Fields like `expr` operators can be grouped together by their meanings, the lexicographical orders are not so important.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] tokers commented on a change in pull request #345: feat: schema for apisixroute

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #345:
URL: https://github.com/apache/apisix-ingress-controller/pull/345#discussion_r610988811



##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: true # we have to enable it since plugin config
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"
+                      hosts:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^\\*?[0-9a-zA-Z-._]+$"

Review comment:
       I refer to APISIX.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] gxthrj commented on a change in pull request #345: feat: schema for apisixroute

Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #345:
URL: https://github.com/apache/apisix-ingress-controller/pull/345#discussion_r610509723



##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: true # we have to enable it since plugin config
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"
+                      hosts:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^\\*?[0-9a-zA-Z-._]+$"

Review comment:
       ```suggestion
                             pattern: "(^\*?[a-zA-Z0-9._-]+$|^\*$)"
   ```

##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: true # we have to enable it since plugin config
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"

Review comment:
       ```suggestion
                             pattern: "^\/[a-zA-Z0-9\-._~%!$&'()+,;=:@/]*\*?$"
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] tokers commented on a change in pull request #345: feat: schema for apisixroute

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #345:
URL: https://github.com/apache/apisix-ingress-controller/pull/345#discussion_r610450417



##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: false
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"
+                      hosts:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^\\*?[0-9a-zA-Z-._]+$"
+                      methods:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          enum: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"]
+                      remoteAddrs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                      exprs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: object
+                          properties:
+                            subject:
+                              type: object
+                              properties:
+                                scope:
+                                  type: string
+                                  enum: ["Header", "Query", "Cookie", "Path"]
+                                name:
+                                  type: string
+                                  minLength: 1
+                              required:
+                              - scope
+                            op:
+                              type: string
+                              enum:
+                                - Equal
+                                - NotEqual
+                                - GreaterThan
+                                - LessThan
+                                - In
+                                - NotIn
+                                - RegexMatch

Review comment:
       I grouped them by their meanings.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix-ingress-controller] tokers commented on a change in pull request #345: feat: schema for apisixroute

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #345:
URL: https://github.com/apache/apisix-ingress-controller/pull/345#discussion_r610441673



##########
File path: samples/deploy/crd/v1beta1/ApisixRoute.yaml
##########
@@ -35,3 +48,146 @@ spec:
     kind: ApisixRoute
     shortNames:
       - ar
+  preserveUnknownFields: false
+  validation:
+    openAPIV3Schema:
+      type: object
+      properties:
+        spec:
+          type: object
+          properties:
+            http:
+              type: array
+              minItems: 1
+              items:
+                type: object
+                oneOf:
+                  - required: ["name", "match", "backend"]
+                  - required: ["name", "match", "backends"]
+                properties:
+                  name:
+                    type: string
+                    minLength: 1
+                  priority:
+                    type: integer
+                  match:
+                    type: object
+                    required:
+                    - paths
+                    properties:
+                      paths:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^/" # start with "/"
+                      hosts:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^\\*?[0-9a-zA-Z-._]+$"
+                      methods:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          enum: ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS", "CONNECT", "TRACE"]
+                      remoteAddrs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                      exprs:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: object
+                          properties:
+                            subject:
+                              type: object
+                              properties:
+                                scope:
+                                  type: string
+                                  enum: ["Header", "Query", "Cookie", "Path"]

Review comment:
       Good point.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org