apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: microservices.imran.dev.io
spec:
  group: imran.dev.io
  scope: Namespaced
  names:
    plural: microservices
    singular: microservice
    kind: Microservice
    shortNames:
    - ms
  versions:
  - name: v1alpha1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              replicas:
                type: integer
                minimum: 1
              image:
                type: string
              port:
                type: integer
                minimum: 1
                maximum: 65535
              labels:
                type: object
                additionalProperties:
                  type: string
              env:
                type: array
                items:
                  type: object
                  properties:
                    name:
                      type: string
                    value:
                      type: string
                    valueFrom:
                      type: object
                      properties:
                        secretKeyRef:
                          type: object
                          properties:
                            name:
                              type: string
                            key:
                              type: string
                        configMapKeyRef:
                          type: object
                          properties:
                            name:
                              type: string
                            key:
                              type: string
              resources:
                type: object
                properties:
                  limits:
                    type: object
                    properties:
                      cpu:
                        type: string
                      memory:
                        type: string
                  requests:
                    type: object
                    properties:
                      cpu:
                        type: string
                      memory:
                        type: string
            required:
            - replicas
            - image
            - port
          status:
            type: object
            properties:
              ready:
                type: string
    additionalPrinterColumns:
    - name: Replicas
      type: integer
      description: The number of replicas
      jsonPath: .spec.replicas
    - name: Port
      type: integer
      description: The port number
      jsonPath: .spec.port