apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: kuryrnetpolicies.openstack.org
spec:
  group: openstack.org
  scope: Namespaced
  names:
    plural: kuryrnetpolicies
    singular: kuryrnetpolicy
    kind: KuryrNetPolicy
  versions:
  - name: v1
    served: true
    storage: true
    additionalPrinterColumns:
      - name: SG-ID
        type: string
        description: The ID of the SG associated to the policy
        jsonPath: .spec.securityGroupId
      - name: Age
        type: date
        jsonPath: .metadata.creationTimestamp
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            required:
            - egressSgRules
            - ingressSgRules
            - networkpolicy_spec
            - podSelector
            - securityGroupId
            properties:
              egressSgRules:
                type: array
                items:
                  type: object
                  required:
                  - security_group_rule
                  properties:
                    remote_ip_prefixes:
                      type: object
                      x-kubernetes-preserve-unknown-fields: true
                    namespace:
                      type: string
                    security_group_rule:
                      type: object
                      required:
                      - id
                      properties:
                        description:
                          type: string
                        direction:
                          type: string
                        ethertype:
                          type: string
                        id:
                          type: string
                        port_range_max:
                          type: integer
                        port_range_min:
                          type: integer
                        protocol:
                          type: string
                        remote_ip_prefix:
                          type: string
                        security_group_id:
                          type: string
              ingressSgRules:
                type: array
                items:
                  type: object
                  required:
                  - security_group_rule
                  properties:
                    remote_ip_prefixes:
                      x-kubernetes-preserve-unknown-fields: true
                      type: object
                    namespace:
                      type: string
                    security_group_rule:
                      type: object
                      required:
                      - id
                      properties:
                        description:
                          type: string
                        direction:
                          type: string
                        ethertype:
                          type: string
                        id:
                          type: string
                        port_range_max:
                          type: integer
                        port_range_min:
                          type: integer
                        protocol:
                          type: string
                        remote_ip_prefix:
                          type: string
                        security_group_id:
                          type: string
              networkpolicy_spec:
                type: object
                properties:
                  podSelector:
                    x-kubernetes-preserve-unknown-fields: true
                    type: object
                  policyTypes:
                    type: array
                    items:
                      type: string
                  ingress:
                    type: array
                    items:
                      x-kubernetes-preserve-unknown-fields: true
                      type: object
                  egress:
                    type: array
                    items:
                      x-kubernetes-preserve-unknown-fields: true
                      type: object
              podSelector:
                x-kubernetes-preserve-unknown-fields: true
                type: object
              securityGroupId:
                type: string
              securityGroupName:
                type: string
