apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: serviceimports.ako.vmware.com
spec:
  conversion:
    strategy: None
  group: ako.vmware.com
  names:
    kind: ServiceImport
    listKind: ServiceImportList
    plural: serviceimports
    shortNames:
    - si
    singular: serviceimport
  scope: Namespaced

  versions:
  - name: v1alpha1
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              cluster:
                description: "Cluster from which this service is imported from"
                type: "string"
              namespace:
                description: "namespace in the backend cluster where this service exists"
                type: "string"
              service:
                description: "name of the service in the backend cluster"
                type: "string"
              svcPorts:
                description: "ports specified for this service in the MCI object"
                type: array
                items:
                  type: object
                  properties:
                    port:
                      description: "service port specified for this service in the MCI object"
                      type: integer
                    endpoints:
                      description: "endpoints for this service in the backend cluster"
                      type: array
                      items:
                        type: object
                        properties:
                          ip:
                            description: "IP address of the backend server"
                            type: "string"
                          port:
                            description: "Port number of the backend server"
                            type: integer

        required:
        - spec
    served: true
    storage: true
