apiVersion: apiextensions.crossplane.io/v1
kind: CompositeResourceDefinition
metadata:
  name: virtualmachines.proxmox.sankofa.nexus
spec:
  group: proxmox.sankofa.nexus
  names:
    kind: VirtualMachine
    plural: virtualmachines
  versions:
  - name: v1alpha1
    served: true
    referenceable: true
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              parameters:
                type: object
                properties:
                  name:
                    type: string
                    description: Name of the virtual machine
                  node:
                    type: string
                    description: Proxmox node to deploy on
                  cpu:
                    type: integer
                    description: Number of CPU cores
                    default: 2
                  memory:
                    type: string
                    description: Memory in GB (e.g., "4Gi")
                    default: "4Gi"
                  disk:
                    type: string
                    description: Disk size (e.g., "50Gi")
                    default: "50Gi"
                  storage:
                    type: string
                    description: Storage pool name
                    default: "local-lvm"
                  network:
                    type: string
                    description: Network bridge
                    default: "vmbr0"
                  image:
                    type: string
                    description: OS image template
                    default: "ubuntu-22.04-cloud"
                  site:
                    type: string
                    description: Proxmox site identifier
                required:
                - name
                - node
                - site
            required:
            - parameters
          status:
            type: object
            properties:
              vmId:
                type: integer
              state:
                type: string
              ipAddress:
                type: string
              conditions:
                type: array
                items:
                  type: object
                  properties:
                    type:
                      type: string
                    status:
                      type: string
                    reason:
                      type: string
                    message:
                      type: string
    additionalPrinterColumns:
    - name: VMID
      type: integer
      jsonPath: .status.vmId
    - name: STATE
      type: string
      jsonPath: .status.state
    - name: IP
      type: string
      jsonPath: .status.ipAddress
    - name: AGE
      type: date
      jsonPath: .metadata.creationTimestamp
  claimNames:
    kind: VirtualMachineClaim
    plural: virtualmachineclaims

