---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: projects.riasc.eu
spec:
  scope: Cluster
  group: riasc.eu
  names:
    kind: Project
    plural: projects
    singular: project
    shortNames:
    - pro
  versions:
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        description: |
          A project provides a limited set of users access to a limited set of nodes.
          A project is backed by a Namespace and set of Roles and RoleBindings

          More info:
          - https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/
          - https://kubernetes.io/docs/reference/access-authn-authz/rbac/

        properties:
          spec:
            type: object
            description: Project specification.
            properties:
              users:
                type: array
                items:
                  type: string
                example:
                - svogel
                - ogehrke

              nodes:
                type: array
                description: |
                  A list of node names to which users of this project have access to.
                items:
                  type: string
                example:
                - rpi-rwth-1
                - rpi-dtu-1

              nodeSelector:
                type: object
                description: |
                  NodeSelector is a selector which must be true for the pod to fit on a node.
                  Selector which must match a node's labels for the pod to be scheduled on that node.

                  More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/

                x-kubernetes-preserve-unknown-fields: true
                example:
                  riasc.eu/lab: ait-smartest
