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

tokers 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 9deb22f  feat: schema for apisixroute (#345)
9deb22f is described below

commit 9deb22f6fd6fc1d26b6828c1356ce5617ce2475b
Author: Alex Zhang <[email protected]>
AuthorDate: Sat Apr 10 12:16:13 2021 +0800

    feat: schema for apisixroute (#345)
---
 samples/deploy/crd/v1beta1/ApisixRoute.yaml | 156 ++++++++++++++++++++++++++++
 1 file changed, 156 insertions(+)

diff --git a/samples/deploy/crd/v1beta1/ApisixRoute.yaml 
b/samples/deploy/crd/v1beta1/ApisixRoute.yaml
index af70902..bc933d1 100644
--- a/samples/deploy/crd/v1beta1/ApisixRoute.yaml
+++ b/samples/deploy/crd/v1beta1/ApisixRoute.yaml
@@ -20,6 +20,19 @@ kind: CustomResourceDefinition
 metadata:
   name: apisixroutes.apisix.apache.org
 spec:
+  additionalPrinterColumns:
+    - JSONPath: .spec.http[].match.hosts[]
+      name: Hosts
+      type: string
+    - JSONPath: .spec.http[].match.paths[]
+      name: URIs
+      type: string
+    - JSONPath: .spec.http[].match.backends[].serviceName
+      name: Target Service
+      type: string
+    - JSONPath: .metadata.creationTimestamp
+      name: Age
+      type: date
   group: apisix.apache.org
   versions:
     - name: v1
@@ -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: "^/[a-zA-Z0-9\\-._~%!$&'()+,;=:@/]*\\*?$"
+                      hosts:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          pattern: "^\\*?[0-9a-zA-Z-._]+$"
+                      methods:
+                        type: array
+                        minItems: 1
+                        items:
+                          type: string
+                          enum: ["CONNECT", "DELETE", "GET", "HEAD", 
"OPTIONS", "PATCH", "POST", "PUT", "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: ["Cookie", "Header", "Path", "Query"]
+                                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"]
+                  backend:
+                    type: object
+                    properties:
+                      serviceName:
+                        type: string
+                        minLength: 1
+                      servicePort:
+                        type: integer
+                        minimum: 1
+                        maximum: 65535
+                      resolveGranualrity:
+                        type: string
+                        enum: ["endpoint", "service"]
+                      weight:
+                        type: integer
+                    required:
+                      - serviceName
+                      - servicePort
+                  backends:
+                    type: array
+                    minItems: 1
+                    items:
+                      type: object
+                      properties:
+                        serviceName:
+                          type: string
+                          minLength: 1
+                        servicePort:
+                          type: integer
+                          minimum: 1
+                          maximum: 65535
+                        resolveGranualrity:
+                          type: string
+                          enum: ["endpoint", "service"]
+                        weight:
+                          type: integer
+                    required:
+                      - serviceName
+                      - servicePort
+                  plugins:
+                    type: array
+                    items:
+                      type: object
+                      properties:
+                        name:
+                          type: string
+                          minLength: 1
+                        enable:
+                          type: boolean
+                        config:
+                          type: object
+                    required:
+                      - name
+                      - enable

Reply via email to