apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  # name must match the spec fields below, and be in the form: <plural>.<group>
  name: games.retro.sparkfabrik.com
spec:
  # group name to use for REST API: /apis/<group>/<version>
  group: retro.sparkfabrik.com
  # list of versions supported by this CustomResourceDefinition
  versions:
    - name: v1
      # Each version can be enabled/disabled by Served flag.
      served: true
      # One and only one version must be marked as the storage version.
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                name:
                  type: string
                zipUrl:
                  type: string
                dir:
                  type: string
                exe:
                  type: string
              required:
              - name
              - zipUrl
              - dir
              - exe
            status:
             type: object
             description: GameStatus defines the observed state of Game
             properties:
              gameState:
                type: string
      subresources:
        status: {}
      # The columns we see in the kubectl output.
      additionalPrinterColumns:
      - name: Game name
        type: string
        description: The game name
        jsonPath: .spec.name
      - name: GSURL
        type: string
        description: The zip url of this game
        jsonPath: .spec.zipUrl
      - name: status
        type: string
        description: The game status
        jsonPath: .status.gameState
      - name: age
        type: date
        description: Age
        jsonPath: .metadata.creationTimestamp
  scope: Namespaced
  names:
    plural: games
    singular: game
    kind: Game
    shortNames:
    - gm
