apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.12.0
  name: containerdeployments.app.container.mom
spec:
  group: app.container.mom
  names:
    kind: ContainerDeployment
    listKind: ContainerDeploymentList
    plural: containerdeployments
    singular: containerdeployment
  scope: Namespaced
  versions:
  - name: v1alpha1
    schema:
      openAPIV3Schema:
        description: ContainerDeployment is the Schema for the containerdeployments API
        properties:
          apiVersion:
            description: 'APIVersion defines the versioned schema of this representation of an object.'
            type: string
          kind:
            description: 'Kind is a string value representing the REST resource this object represents.'
            type: string
          metadata:
            type: object
          spec:
            description: ContainerDeploymentSpec defines the desired state of ContainerDeployment
            properties:
              name:
                description: Name of the deployment
                type: string
              source:
                description: Source configuration for the deployment
                type: object
                properties:
                  type:
                    description: Type of source (git or registry)
                    type: string
                    enum: [git, registry]
                  url:
                    description: URL of the Git repository or container registry
                    type: string
                  credentials:
                    description: Optional credentials for private repositories/registries
                    type: object
                    properties:
                      username:
                        type: string
                      password:
                        type: string
                    required: []
                required:
                - type
                - url
              resources:
                description: Resource requirements for the deployment
                type: object
                properties:
                  cpu:
                    description: CPU cores (e.g., "0.5", "1")
                    type: string
                  memory:
                    description: Memory (e.g., "512Mi", "1Gi")
                    type: string
                  storage:
                    description: Storage (e.g., "1Gi", "10Gi")
                    type: string
                required:
                - cpu
                - memory
              regions:
                description: List of regions to deploy to
                type: array
                items:
                  type: string
                  enum: [eu-central, eu-east, us-east, us-west]
              domain:
                description: Domain configuration
                type: object
                properties:
                  custom:
                    description: Optional custom domain
                    type: string
                  containerMomSubdomain:
                    description: Auto-generated *.container.mom subdomain
                    type: string
              billing:
                description: Billing configuration
                type: object
                properties:
                  customerID:
                    description: Stripe customer ID
                    type: string
                  plan:
                    description: Selected billing plan
                    type: string
                required:
                - customerID
                - plan
            required:
            - name
            - source
            - resources
            - regions
            - billing
            type: object
          status:
            description: ContainerDeploymentStatus defines the observed state of ContainerDeployment
            properties:
              phase:
                description: Current phase of the deployment
                type: string
                enum: [Pending, Deploying, Running, Failed]
              conditions:
                description: Detailed status conditions
                type: array
                items:
                  type: object
                  properties:
                    type:
                      description: Type of deployment condition
                      type: string
                    status:
                      description: Status of the condition
                      type: string
                    lastTransitionTime:
                      description: Last time the condition transitioned
                      type: string
                      format: date-time
                    reason:
                      description: Reason for the condition's last transition
                      type: string
                    message:
                      description: Human-readable message indicating details about last transition
                      type: string
              endpoints:
                description: Access endpoints for the deployment
                type: array
                items:
                  type: object
                  properties:
                    url:
                      description: URL of the endpoint
                      type: string
                    type:
                      description: Type of endpoint (http, https)
                      type: string
                    region:
                      description: Region this endpoint is serving
                      type: string
            required:
            - phase
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
