const ( // A display's card where the card could not be found. UnknownCard = "unknown" // A display which was disconnected during the V1 to V2 upgrade. DisconnectedPort = "disconnected" )
const ( Name = "display" Group = "display.edge.ncr.com" NodeDisplayConfigKind = "NodeDisplayConfig" )
const ( DisplayManagerRestartedAtAnnotation = "display.edge.ncr.com/display-manager-restarted-at" DevicesUpdatedAtAnnotation = "display.edge.ncr.com/devices-updated-at" // Whether the display manager has been configured successfully. DisplayManagerConfiguredCondition = "DisplayManagerConfigured" // Whether the NodeDisplayConfig has default or custom configuration. DefaultCondition = "Default" // Whether displayctl is enabled for the node. When disabled no // configuration will be done by displayctl, leaving the display // manager to be configured by the xserver-config ConfigMap. DisplayctlEnabledCondition = "DisplayctlEnabled" // Whether there exists additional display manager config for the // node, e.g. in xserver-config ConfigMap. DisplayManagerConfigCondition = "DisplayManagerConfig" ReconcilingStatus = "Reconciling" UpToDateStatus = "UpToDate" FailedStatus = "Failed" UpgradingStatus = "Upgrading" DisabledStatus = "Disabled" DefaultConfigurationStatus = "DefaultConfiguration" CustomConfigurationStatus = "CustomConfiguration" DisplayctlEnabledStatus = "DisplayctlEnbled" DisplayctlDisabledStatus = "DisplayctlDisabled" ConfigExistsStatus = "ConfigExists" ConfigDoesNotExistStatus = "ConfigDoesNotExist" )
var ( // GroupVersion is group version used to register these objects GroupVersion = schema.GroupVersion{Group: Group, Version: "v2"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme // GroupVersionKind for the NodeDisplayConfig type NodeDisplayConfigGVK = schema.GroupVersionKind{ Group: GroupVersion.Group, Version: GroupVersion.Version, Kind: NodeDisplayConfigKind, } )
The default display configuration:
var Defaults = DefaultConfig{ Display: Display{ Orientation: &NormalOrientation, }, KnownDisplays: map[MPID]KnownDisplayDefaults{ "ACR-2199": { InputDevicePatterns: []string{ "Weida Hi-Tech\\s+CoolTouchR System\\s+.*", }, }, "ELO-4098": { InputDevicePatterns: []string{ "Elo Touch Solutions Elo Touch Solutions Pcap USB Interface", }, }, "ELO-5705": { InputDevicePatterns: []string{ "Atmel Atmel maXTouch Digitizer", "Elo TouchSystems, Inc\\. Elo TouchSystems 2700.*", }, }, "ELO-5911": { InputDevicePatterns: []string{ "Elo TouchSystems, Inc\\. Elo TouchSystems 2700.*", }, }, "ELO-8816": { InputDevicePatterns: []string{ "Elo Touch\\s+2270L pCAP HID\\s+.*", }, }, "NCR-22800": { InputDevicePatterns: []string{ "eGalax Inc\\. eGalaxTouch EXC[A-Z0-9]{4}-.*", }, }, "NCR-22805": { InputDevicePatterns: []string{ "eGalax Inc\\. eGalaxTouch EXC[A-Z0-9]{4}-.*", }, }, "NCR-22888": { InputDevicePatterns: []string{ "eGalax Inc\\. eGalaxTouch EXC[A-Z0-9]{4}-.*", "Advanced Silicon S\\.A\\. CoolTouch® System", }, }, "NCR-22917": { InputDevicePatterns: []string{ "eGalax Inc\\. eGalaxTouch EXC[A-Z0-9]{4}-.*", }, }, "NCR-30578": { InputDevicePatterns: []string{ "eGalax Inc\\. eGalaxTouch P8[A-Z0-9]{4} [A-Z0-9]{4}.*", }, }, "TGC-18464": { InputDevicePatterns: []string{ "Elo TouchSystems Inc\\. Elo TouchSystems CarrollTouch.*", }, }, "VSC-23866": { InputDevicePatterns: []string{ "iSolution multitouch.*", }, }, "WNX-22": { InputDevicePatterns: []string{ "Beijing IRTOUCH SYSTEMS Co\\.,LtD IRTOUCH InfraRed TouchScreen.*", }, }, "WNX-30022": { InputDevicePatterns: []string{ "eGalax Inc\\. eGalaxTouch P8[A-Z0-9]{4} [A-Z0-9]{4}.*", }, }, "WNX-30028": { InputDevicePatterns: []string{ "eGalax Inc\\. eGalaxTouch P8[A-Z0-9]{4} [A-Z0-9]{4}.*", }, }, "WNX-32": { InputDevicePatterns: []string{ "Beijing IRTOUCH SYSTEMS Co\\.,LtD IRTOUCH InfraRed TouchScreen.*", }, }, }, DPMS: &DPMS{ Enabled: &dpmsDisabled, BlankTime: &zeroSeconds, StandbyTime: &zeroSeconds, SuspendTime: &zeroSeconds, OffTime: &zeroSeconds, }, }
type AppliedStatus struct { // The DisplayConfig configuration that was applied to the node. DisplayConfig *DisplayConfig `json:"displayConfig,omitempty"` // The output identifiers of the displays configured on the node. Displays []DisplayPort `json:"displays,omitempty"` // The generation of the object that was last applied to the node. Generation int64 `json:"lastAppliedGeneration,omitempty"` // Timestamp when configuration was last applied to the node. LastAppliedTimestamp metav1.Time `json:"lastAppliedTimestamp,omitempty"` }
func (in *AppliedStatus) DeepCopy() *AppliedStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AppliedStatus.
func (in *AppliedStatus) DeepCopyInto(out *AppliedStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
DPMS describes the DPMS configuration for a display.
type DPMS struct { // Enabled indicates whether DPMS is enabled for the node. Enabled *bool `json:"enabled,omitempty"` // +kubebuilder:validation:Minimum=0 // // BlankTime configures the number of seconds of inactivity // before reaching the blank phase of the screen saver. BlankTime *int `json:"blankTime,omitempty"` // +kubebuilder:validation:Minimum=0 // // StandbyTime configures the number of seconds of inactivity // before reaching the standby phase of the DPMS mode. StandbyTime *int `json:"standybyTime,omitempty"` // +kubebuilder:validation:Minimum=0 // // SuspendTime configures the number of seconds of inactivity // before reaching the suspend phase of the DPMS mode. SuspendTime *int `json:"suspendTime,omitempty"` // +kubebuilder:validation:Minimum=0 // // OffTime configures the number of seconds of inactivity // before reaching the off phase of the DPMS mode. OffTime *int `json:"offTime,omitempty"` }
func (in *DPMS) DeepCopy() *DPMS
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DPMS.
func (in *DPMS) DeepCopyInto(out *DPMS)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (a *DPMS) Merge(b *DPMS) (*DPMS, error)
Configures the default display configuration to be passed into displayConfig.GenerateDefaultDisplayConfig(DefaultConfig,inputDevices).
type DefaultConfig struct { // The default display configuration that will be applied // to each display. Display Display // Mapping of pre-defined display configurations for displays // we know need additional configuration. Most often this // consists of known input device mappings. KnownDisplays map[MPID]KnownDisplayDefaults // The default DPMS configuration. DPMS *DPMS }
func (in *DefaultConfig) DeepCopy() *DefaultConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DefaultConfig.
func (in *DefaultConfig) DeepCopyInto(out *DefaultConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
Display configures a display's monitor and input devices.
type Display struct { // DisplayPort is the display card and physical port the // display is connected to, e.g. card0-DP1, card1-HDMI2 etc. // // This field is NOT optional. DisplayPort `json:"displayPort"` // Manufacturer and Product-Code ID, a unique identifier // for the display, i.e. "<manufacturer-ID>-<product-code>". // // It is NOT valid to configure this field in the // NodeDisplayConfig spec. *MPID `json:"mpid,omitempty"` // Primary indicates whether this is the primary display. *Primary `json:"primary,omitempty"` // Orientation of the display, e.g "left" or "inverted". Orientation *Orientation `json:"orientation,omitempty"` // Resolution is the current resolution of the display. *Resolution `json:"resolution,omitempty"` // SupportedResolutions are the valid resolutions the // display can be configured to use. // // It is NOT valid to configure this field in the // NodeDisplayConfig spec. The resolution of the display // can be configured via the Resolution field. SupportedResolutions []Resolution `json:"supportedResolutions,omitempty"` // InputDeviceMappings are the devices the display maps to. InputDeviceMappings []InputDeviceName `json:"inputDeviceMappings,omitempty"` }
func (in *Display) DeepCopy() *Display
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Display.
func (in *Display) DeepCopyInto(out *Display)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (display *Display) IsPrimary() bool
func (a *Display) Merge(b Display) (*Display, error)
Merge Display B into Display A and return a new copy.
When a value is present in B set it in A, otherwise use the value from A.
Input device mappings in b will always replace the mappings in a if the mappings in B are not empty, i.e. mappings in B are not appended to those in A.
func (display *Display) SetPrimary(primary bool)
DisplayConfig defines the configuration for displays.
type DisplayConfig struct { // Maps monitor display-ports to display configurations. Displays Displays `json:"displays,omitempty"` // DPMS configuration DPMS *DPMS `json:"dpms,omitempty"` // Layout of the displays as slice, ordered left to right. Layout Layout `json:"layout,omitempty"` // The V1 spec following conversion from V1 to V2 by the // conversion webhook. This will be used by displayctl to // upgrade the spec to V2. // // This must only be set during conversion from V1 to V2 // and cannot be set after the upgrade is complete. V1 *v1.DisplayConfig `json:"v1-displayConfig,omitempty"` }
func DisplayConfigFromV1(src *v1.DisplayConfig, displayConfig *DisplayConfig) (result *DisplayConfig, disconnectedIDs map[DisplayPort]MPID)
Converts a V1 DisplayConfig to V2.
As the identifier for displays moves from MPID to DisplayPort, the conversion requires the current display configuration read from the node. Using this we can tell which port displays identified by MPID are connected to.
For displays which have been specified in the V1 display config, but are not connected at the time of the conversion, their DisplayPort will be marked as disconnected. A map of disconnected DisplayPorts to MPIDs will also be returned, so they can later be converted later on if the display is reconnected.
func (in *DisplayConfig) DeepCopy() *DisplayConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DisplayConfig.
func (in *DisplayConfig) DeepCopyInto(out *DisplayConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (displayConfig *DisplayConfig) DisplayPorts() []DisplayPort
The set of display-ports from both the displays and layout fields.
func (a *DisplayConfig) GenerateDefaultDisplayConfig(defaults DefaultConfig, inputDevices []InputDeviceName) (*DisplayConfig, error)
Applies the default configuration to the display config.
Merges the default display with each of the displays in the display config.
For any display where a display with matching MPID exists in the default known displays, their configurations are merged together.
Sets the first display in the layout as the primary display. If there is no layout, the first display will be primary.
DPMS is overwritten with the default DPMS configuration.
func (displayConfig *DisplayConfig) HasDisconnected() bool
Whether any of the displays were disconnected during V1 to V2 upgrade and still requrie display-port identification.
func (displayConfig *DisplayConfig) HasV1() bool
Whether there is V1 spec which is yet to be upgraded.
func (a *DisplayConfig) Merge(b *DisplayConfig) (*DisplayConfig, error)
Merge B into A and return a new copy.
We assume A is a valid display configuration, i.e. details all displays that are present on the node, and only apply configuration from B when it matches displays in A.
When a display is present in both A and B, the displays will be merged in the result - see Display.Merge(Display) for more detail. If a display is present in A but not in B, it will be added to the result without changes. If a display is present in B, but not A it will not be added to the result.
The Layout from B will be merged into A. Only displays in B also present in A will be respected. See Layout.Merge(Layout) for more detail.
func (displayConfig *DisplayConfig) Validate() error
Validates the DisplayConfig, checking:
+kubebuilder:validation:Pattern=`^(unknown|card\d)(-[A-Za-z0-9]+)+$`
DisplayPort is the display card and physical port the display is connected to, e.g. card0-DP1, card1-HDMI-A-2 etc.
If a card cannot be found for a display it will be marked unknown, e.g. unknown-DP2.
Displays that were disconnected during upgrade from V1 to V2 will be marked disconnected, e.g. unknown-disconnected-1.
type DisplayPort string
func NewDisplayPort(card, port string) DisplayPort
func (dp DisplayPort) IsConnected() bool
Whether a display is connected.
A display can be disconnected if it was not present during the V1 to V2 upgrade.
func (dp *DisplayPort) String() string
type Displays []Display
func (in Displays) DeepCopy() Displays
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Displays.
func (in Displays) DeepCopyInto(out *Displays)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (displays Displays) DisplayPorts() []DisplayPort
Returns the displays display-ports.
func (displays Displays) FindByDisplayPort(dp DisplayPort) *Display
The display with given display-port (nil if not found).
func (displays Displays) FindByMPID(mpid MPID) *Display
The display with given MPID (nil if not found).
func (displays Displays) FindPrimary() *Display
The primary display.
func (a Displays) Merge(b Displays) (Displays, error)
func (displays *Displays) UpdateDisplay(display Display)
Updates the display with matching display-port. Adds a new display if it is not yet present.
InputDeviceName is the name of an input device
type InputDeviceName string
func (name *InputDeviceName) String() string
type KnownDisplayDefaults struct { InputDevicePatterns []string }
func (in *KnownDisplayDefaults) DeepCopy() *KnownDisplayDefaults
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KnownDisplayDefaults.
func (in *KnownDisplayDefaults) DeepCopyInto(out *KnownDisplayDefaults)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
Layout describes the physical position of displays as their display-port's ordered left to right.
type Layout []DisplayPort
func (in Layout) DeepCopy() Layout
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Layout.
func (in Layout) DeepCopyInto(out *Layout)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (a Layout) Merge(b Layout) Layout
Merge Layout B into Layout A and return a new copy.
For each display in B present in A, we append to the result respecting the order in B. For the remaining display in A not present in B, we append to the result respecting the order in A.
+kubebuilder:validation:Pattern=`^[A-Z]{3}-\d{1,5}$`
Manufacturer and Product-Code ID, a unique identifier for the display, i.e. "<manufacturer-ID>-<product-code>".
type MPID string
func NewMPID(manufacturer string, productCode uint) MPID
func (mpid *MPID) String() string
A NodeDisplayConfig defines custom display configuration for a node, defined as a DisplayConfig. It's status details the DisplayConfig that was applied to the node by displayctl.
type NodeDisplayConfig struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec *DisplayConfig `json:"spec,omitempty"` Status NodeDisplayConfigStatus `json:"status,omitempty"` }
func (nodeDisplayConfig *NodeDisplayConfig) AppliedDisplayConfig() *DisplayConfig
The DisplayConfig last applied to the node.
func (dst *NodeDisplayConfig) ConvertFrom(src conversion.Hub) error
Converts V1 to V2.
This simply copies the V1 spec into the V2 NodeDisplayConfig to be upgraded by displayctl later on.
func (src *NodeDisplayConfig) ConvertTo(dst conversion.Hub) error
Converts V2 to V1.
V1 is deprecated and not in use. Conversion from V2 to V1 is unsupported and simply removes the spec from the object. As V2 is the stored version there is no data loss and the spec can always be retrieved via the V2 API.
func (in *NodeDisplayConfig) DeepCopy() *NodeDisplayConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeDisplayConfig.
func (in *NodeDisplayConfig) DeepCopyInto(out *NodeDisplayConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeDisplayConfig) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (nodeDisplayConfig *NodeDisplayConfig) DisconnectedDisplayIDs() map[DisplayPort]MPID
MPIDs of displays that were disconnected during V1 to V2 upgrade. These IDs are retained so display-ports can be assigned to the displays once they are reconnected to the node.
func (nodeDisplayConfig *NodeDisplayConfig) GetConditions() []metav1.Condition
func (nodeDisplayConfig *NodeDisplayConfig) LastConfiguredTime() (time.Time, error)
The last time displayctl configured the displays.
func (nodeDisplayConfig *NodeDisplayConfig) ResetStatus()
func (nodeDisplayConfig *NodeDisplayConfig) SetAppliedConfigStatuses(displayConfig *DisplayConfig)
Updated the NodeDisplayConfig status with information about the display configuration that was last applied to the node.
func (nodeDisplayConfig *NodeDisplayConfig) SetConditions(conditions []metav1.Condition)
func (nodeDisplayConfig *NodeDisplayConfig) SetDefaultCondition()
func (nodeDisplayConfig *NodeDisplayConfig) SetDisplayManagerConfigCondition(configName string)
func (nodeDisplayConfig *NodeDisplayConfig) SetDisplayManagerConfiguredCondition(ready bool, reason, message string)
func (nodeDisplayConfig *NodeDisplayConfig) SetDisplayctlEnabledCondition(enabled bool)
func (nodeDisplayConfig *NodeDisplayConfig) SetupWebhookWithManager(mgr ctrl.Manager) error
func (nodeDisplayConfig *NodeDisplayConfig) ValidateCreate() (admission.Warnings, error)
func (*NodeDisplayConfig) ValidateDelete() (admission.Warnings, error)
func (nodeDisplayConfig *NodeDisplayConfig) ValidateUpdate(runtime.Object) (admission.Warnings, error)
type NodeDisplayConfigList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` Items []NodeDisplayConfig `json:"items"` }
func (in *NodeDisplayConfigList) DeepCopy() *NodeDisplayConfigList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeDisplayConfigList.
func (in *NodeDisplayConfigList) DeepCopyInto(out *NodeDisplayConfigList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NodeDisplayConfigList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type NodeDisplayConfigStatus struct { // The configuration that was applied to the node. Applied AppliedStatus `json:"applied,omitempty"` // Stores upgrade status for partially-upgraded objects. Upgrade UpgradeStatus `json:"upgrade,omitempty"` Conditions []metav1.Condition `json:"conditions,omitempty"` }
func (in *NodeDisplayConfigStatus) DeepCopy() *NodeDisplayConfigStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeDisplayConfigStatus.
func (in *NodeDisplayConfigStatus) DeepCopyInto(out *NodeDisplayConfigStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+kubebuilder:validation:Enum=normal;left;right;inverted
Orientation is the displays orientation, e.g "normal", "left", "right" or "inverted".
type Orientation string
var ( NormalOrientation Orientation = "normal" LeftOrientation Orientation = "left" RightOrientation Orientation = "right" InvertedOrientation Orientation = "inverted" )
func (o *Orientation) String() string
Primary indicates whether a display is the primary display.
type Primary bool
Resolution defines the resolution of a display.
type Resolution struct { // +kubebuilder:validation:Minimum=0 // // Width of the display in pixels. Width int `json:"width"` // +kubebuilder:validation:Minimum=0 // // Height of the display in pixels. Height int `json:"height"` }
func (in *Resolution) DeepCopy() *Resolution
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resolution.
func (in *Resolution) DeepCopyInto(out *Resolution)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (res *Resolution) String() string
type UpgradeStatus struct { // MPIDs for displays disconnected during the upgrade. // Used by displayctl to upgrade the displays if they // are reconnected at later point. DisconnectedDisplays map[DisplayPort]MPID `json:"disconnectedDisplays,omitempty"` }
func (in *UpgradeStatus) DeepCopy() *UpgradeStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpgradeStatus.
func (in *UpgradeStatus) DeepCopyInto(out *UpgradeStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.