apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: physicaldisks.localstorage.hwameistor.io
spec:
  group: localstorage.hwameistor.io
  names:
    kind: PhysicalDisk
    listKind: PhysicalDiskList
    plural: physicaldisks
    shortNames:
    - pd
    singular: physicaldisk
  scope: Cluster
  versions:
  - additionalPrinterColumns:
    - description: Node name where the volume replica is located at
      jsonPath: .spec.nodeName
      name: node
      type: string
    - description: Serial number of the disk
      jsonPath: .spec.serialNumber
      name: serialNumber
      type: string
    - description: Model name of the disk
      jsonPath: .spec.modelName
      name: modelName
      type: string
    - description: Disk path in OS
      jsonPath: .spec.devicePath
      name: device
      type: string
    - description: Disk type
      jsonPath: .spec.type
      name: type
      type: string
    - description: Disk access protocol
      jsonPath: .spec.protocol
      name: protocol
      type: string
    - description: Disk health reported by smartctl
      jsonPath: .status.smartCheck.details.smart_status.passed
      name: health
      type: boolean
    - description: Last time to check disk health
      jsonPath: .status.smartCheck.lastTime
      name: checkTime
      type: date
    - description: Disk online or offline
      jsonPath: .status.online
      name: online
      type: boolean
    - jsonPath: .metadata.creationTimestamp
      name: age
      type: date
    name: v1alpha1
    schema:
      openAPIV3Schema:
        description: PhysicalDisk is the Schema for the physicaldisks API
        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: PhysicalDiskSpec defines the desired state of PhysicalDisk
            properties:
              capacity:
                description: Capacity of the disk
                format: int64
                type: integer
              devicePath:
                description: DevicePath is the path in the OS
                type: string
              formFactor:
                description: FormFactor is the disk size, like 2.5 inches
                type: string
              isRaid:
                description: IsRAID identifies if the disk is a raid disk or not
                type: boolean
              modelName:
                description: ModelName is the name of disk model
                type: string
              nodeName:
                description: Node name of where the disk is attached
                type: string
              pciVendorID:
                description: PCIVendorID is the ID of the PCI vendor, for NVMe disk
                  only
                type: string
              product:
                description: Product is a class of disks the vendor produces
                type: string
              protocol:
                description: Protocol is for data transport, such as ATA, SCSI, NVMe
                type: string
              raidMaster:
                description: RAIDMaster is the master of the RAID disk, it works for
                  only RAID slave disk, e.g. /dev/bus/0
                type: string
              rotationRate:
                description: RotationRate is the rate of the disk rotation
                format: int64
                type: integer
              serialNumber:
                description: SerialNumber is a unique number assigned to a disk
                type: string
              smartSupport:
                description: SmartSupport identified if the disk supports SMART or
                  not
                type: boolean
              type:
                description: Type is the disk type, such as ata, scsi, nvme, megaraid,N,
                  ...
                type: string
              vendor:
                description: Vendor is who provides the disk
                type: string
            type: object
          status:
            description: PhysicalDiskStatus defines the observed state of PhysicalDisk
            properties:
              online:
                description: disk is online or offline. Considering the disk replacement,
                  the replaced disk should be offline
                type: boolean
              smartCheck:
                description: SmartCheck defines the result of the disk smartctl
                properties:
                  ata_smart_attributes:
                    description: ATASmartHealthDetailsInfo struct
                    properties:
                      table:
                        items:
                          description: ATASmartHealthAttribute struct
                          properties:
                            flags:
                              description: ATASmartHealthAttributeFlag struct
                              properties:
                                auto_keep:
                                  type: boolean
                                error_rate:
                                  type: boolean
                                event_count:
                                  type: boolean
                                performance:
                                  type: boolean
                                prefailure:
                                  type: boolean
                                string:
                                  type: string
                                updated_online:
                                  type: boolean
                                value:
                                  format: int64
                                  type: integer
                              required:
                              - auto_keep
                              - error_rate
                              - event_count
                              - performance
                              - prefailure
                              - string
                              - updated_online
                              - value
                              type: object
                            id:
                              format: int64
                              type: integer
                            name:
                              type: string
                            raw:
                              description: ATASmartHealthAttributeRawData struct
                              properties:
                                string:
                                  type: string
                                value:
                                  format: int64
                                  type: integer
                              required:
                              - string
                              - value
                              type: object
                            thresh:
                              format: int64
                              type: integer
                            value:
                              format: int64
                              type: integer
                            when_failed:
                              type: string
                            worst:
                              format: int64
                              type: integer
                          required:
                          - flags
                          - id
                          - name
                          - raw
                          - thresh
                          - value
                          - when_failed
                          - worst
                          type: object
                        type: array
                    type: object
                  lastTime:
                    description: latest time for health check
                    format: date-time
                    type: string
                  nvme_smart_health_information_log:
                    description: NVMeSmartHealthDetailsInfo struct
                    properties:
                      available_spare:
                        format: int64
                        type: integer
                      available_spare_threshold:
                        format: int64
                        type: integer
                      controller_busy_time:
                        format: int64
                        type: integer
                      critical_warning:
                        format: int64
                        type: integer
                      data_units_read:
                        format: int64
                        type: integer
                      data_units_written:
                        format: int64
                        type: integer
                      host_reads:
                        format: int64
                        type: integer
                      host_writes:
                        format: int64
                        type: integer
                      media_errors:
                        format: int64
                        type: integer
                      num_err_log_entries:
                        format: int64
                        type: integer
                      percentage_used:
                        format: int64
                        type: integer
                      power_cycles:
                        format: int64
                        type: integer
                      power_on_hours:
                        format: int64
                        type: integer
                      temperature:
                        format: int64
                        type: integer
                      unsafe_shutdowns:
                        format: int64
                        type: integer
                    required:
                    - available_spare
                    - available_spare_threshold
                    - controller_busy_time
                    - critical_warning
                    - data_units_read
                    - data_units_written
                    - host_reads
                    - host_writes
                    - media_errors
                    - num_err_log_entries
                    - percentage_used
                    - power_cycles
                    - power_on_hours
                    - temperature
                    - unsafe_shutdowns
                    type: object
                  power_on_time:
                    description: PhyDiskPowerOnTimeStatus struct
                    properties:
                      hours:
                        format: int64
                        type: integer
                      minutes:
                        format: int64
                        type: integer
                    type: object
                  scsi_error_counter_log:
                    description: SCSISmartHealthDetailsInfo struct
                    properties:
                      read:
                        description: SCSIErrorCounter struct
                        properties:
                          correction_algorithm_invocations:
                            format: int64
                            type: integer
                          errors_corrected_by_eccdelayed:
                            format: int64
                            type: integer
                          errors_corrected_by_eccfast:
                            format: int64
                            type: integer
                          errors_corrected_by_rereads_rewrites:
                            format: int64
                            type: integer
                          gigabytes_processed:
                            type: string
                          total_errors_corrected:
                            format: int64
                            type: integer
                          total_uncorrected_errors:
                            format: int64
                            type: integer
                        required:
                        - correction_algorithm_invocations
                        - errors_corrected_by_eccdelayed
                        - errors_corrected_by_eccfast
                        - errors_corrected_by_rereads_rewrites
                        - gigabytes_processed
                        - total_errors_corrected
                        - total_uncorrected_errors
                        type: object
                      verify:
                        description: SCSIErrorCounter struct
                        properties:
                          correction_algorithm_invocations:
                            format: int64
                            type: integer
                          errors_corrected_by_eccdelayed:
                            format: int64
                            type: integer
                          errors_corrected_by_eccfast:
                            format: int64
                            type: integer
                          errors_corrected_by_rereads_rewrites:
                            format: int64
                            type: integer
                          gigabytes_processed:
                            type: string
                          total_errors_corrected:
                            format: int64
                            type: integer
                          total_uncorrected_errors:
                            format: int64
                            type: integer
                        required:
                        - correction_algorithm_invocations
                        - errors_corrected_by_eccdelayed
                        - errors_corrected_by_eccfast
                        - errors_corrected_by_rereads_rewrites
                        - gigabytes_processed
                        - total_errors_corrected
                        - total_uncorrected_errors
                        type: object
                      write:
                        description: SCSIErrorCounter struct
                        properties:
                          correction_algorithm_invocations:
                            format: int64
                            type: integer
                          errors_corrected_by_eccdelayed:
                            format: int64
                            type: integer
                          errors_corrected_by_eccfast:
                            format: int64
                            type: integer
                          errors_corrected_by_rereads_rewrites:
                            format: int64
                            type: integer
                          gigabytes_processed:
                            type: string
                          total_errors_corrected:
                            format: int64
                            type: integer
                          total_uncorrected_errors:
                            format: int64
                            type: integer
                        required:
                        - correction_algorithm_invocations
                        - errors_corrected_by_eccdelayed
                        - errors_corrected_by_eccfast
                        - errors_corrected_by_rereads_rewrites
                        - gigabytes_processed
                        - total_errors_corrected
                        - total_uncorrected_errors
                        type: object
                    type: object
                  smart_status:
                    description: details of the health check by smartctl
                    properties:
                      passed:
                        type: boolean
                    type: object
                  temperature:
                    description: PhyDiskTemperatureStatus struct
                    properties:
                      current:
                        format: int64
                        type: integer
                    type: object
                type: object
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
