# fe-component-deployment.crd.yaml
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  # name must match the spec fields below, and be in the form: <plural>.<group>
  name: frontendcomponentdeployments.stable.patricelabs.io
spec:
  # group name to use for frontendcomponents: /frontendcomponentdeployments/<group>/<version>
  group: stable.patricelabs.io
  # 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:
              required: [component, artifacts]
              type: object
              properties:
                component: # FE Component link
                  type: string
                hosting:
                  type: object
                  properties:
                    server:
                      type: string
                      enum: [appServer,staticContentServer]
                    target:
                      type: string
                      enum: [intranet, extranet]
                artifacts:
                  type: array
                  items:
                    type: object # FE Component package
                    properties:
                      version: 
                        type: string # 1.0.0
                      package:
                        type: string # my-component
                      registry:
                        type: string
                      endpointDependencies:
                        type: array
                        items:
                          type: object # API endpoint
                          properties:
                            method:
                              type: string
                            host:
                              type: string
                            pathTemplate:
                              type: string
                  
  # either Namespaced or Cluster
  scope: Namespaced
  names:
    # plural name to be used in the URL: /frontendcomponentdeployments/<group>/<version>/<plural>
    plural: frontendcomponentdeployments
    # singular name to be used as an alias on the CLI and for display
    singular: frontendcomponentdeployment
    # kind is normally the CamelCased singular type. Your resource manifests use this.
    kind: frontendComponentDeployment
    # shortNames allow shorter string to match your resource on the CLI
    shortNames:
    - fecd
