apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: operatingsystemconfigs.operatingsystemmanager.k8c.io
spec:
  group: operatingsystemmanager.k8c.io
  names:
    kind: OperatingSystemConfig
    listKind: OperatingSystemConfigList
    plural: operatingsystemconfigs
    singular: operatingsystemconfig
    shortNames:
      - osc
  scope: Namespaced
  versions:
    - name: v1alpha1
      storage: true
      served: true
      schema:
        openAPIV3Schema:
          description: OperatingSystemConfig is the object that represents the OperatingSystemConfig
          type: object
          required:
            - spec
          properties:
            apiVersion:
              description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
              type: string
            kind:
              description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
              type: string
            metadata:
              type: object
            spec:
              description: OperatingSystemConfigSpec represents the operating system configuration spec.
              type: object
              required:
                - cloudProvider
                - osName
                - osVersion
              properties:
                cloudProvider:
                  description: CloudProvider represent the cloud provider that support the given operating system version
                  type: object
                  required:
                    - name
                  properties:
                    name:
                      description: Name represents the name of the supported cloud provider
                      type: string
                      enum:
                        - aws
                        - azure
                        - digitalocean
                        - gce
                        - hetzner
                        - kubevirt
                        - linode
                        - openstack
                        - equinixmetal
                        - vsphere
                        - fake
                        - alibaba
                        - anexia
                        - scaleway
                        - baremetal
                        - external
                    spec:
                      description: Spec represents the os/image reference in the supported cloud provider
                      type: object
                      x-kubernetes-preserve-unknown-fields: true
                files:
                  description: Files is a list of files that should exist in the instance
                  type: array
                  items:
                    description: File is a file that should get written to the host's file system. The content can either be inlined or referenced from a secret in the same namespace.
                    type: object
                    required:
                      - content
                      - path
                    properties:
                      content:
                        description: Content describe the file's content.
                        type: object
                        properties:
                          inline:
                            description: Inline is a struct that contains information about the inlined data.
                            type: object
                            required:
                              - data
                            properties:
                              data:
                                description: Data is the file's data.
                                type: string
                              encoding:
                                description: Encoding is the file's encoding (e.g. base64).
                                type: string
                      path:
                        description: Path is the path of the file system where the file should get written to.
                        type: string
                      permissions:
                        description: Permissions describes with which permissions the file should get written to the file system. Should be defaulted to octal 0644.
                        type: integer
                        format: int32
                modules:
                  description: CloudInitModules contains the supported cloud-init modules
                  type: object
                  properties:
                    bootcmd:
                      description: BootCMD module runs arbitrary commands very early in the boot process, only slightly after a boothook would run.
                      type: array
                      items:
                        type: string
                    rh_subscription:
                      description: RHSubscription registers a Red Hat system either by username and password or activation and org
                      type: object
                      additionalProperties:
                        type: string
                    runcmd:
                      description: RunCMD Run arbitrary commands at a rc.local like level with output to the console.
                      type: array
                      items:
                        type: string
                osName:
                  description: 'OSType represent the operating system name e.g: ubuntu'
                  type: string
                  enum:
                    - flatcar
                    - rhel
                    - centos
                    - ubuntu
                    - sles
                    - amzn2
                osVersion:
                  description: OSVersion the version of the operating system
                  type: string
                units:
                  description: Units a list of the systemd unit files which will run on the instance
                  type: array
                  items:
                    description: Unit is a systemd unit used for the operating system config.
                    type: object
                    required:
                      - name
                    properties:
                      content:
                        description: Content is the unit's content.
                        type: string
                      dropIns:
                        description: DropIns is a list of drop-ins for this unit.
                        type: array
                        items:
                          description: DropIn is a drop-in configuration for a systemd unit.
                          type: object
                          required:
                            - content
                            - name
                          properties:
                            content:
                              description: Content is the content of the drop-in.
                              type: string
                            name:
                              description: Name is the name of the drop-in.
                              type: string
                      enable:
                        description: Enable describes whether the unit is enabled or not.
                        type: boolean
                      mask:
                        description: Mask describes whether the unit is masked or not.
                        type: boolean
                      name:
                        description: Name is the name of a unit.
                        type: string
                userSSHKeys:
                  description: UserSSHKeys is a list of attached user ssh keys
                  type: array
                  items:
                    type: string
