Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions api/v1alpha1/connector_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,22 @@ const (
PublicKeyConnectorConnectionType ConnectorConnectionType = "PublicKey"
)

type ConnectorDeviceInfo struct {
// Human-readable name of the device running the connector.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Name string `json:"name"`

// Operating system of the device running the connector.
//
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
OS string `json:"os"`
}
Comment on lines +108 to +122
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be required? I'm just thinking of how these would be used in headless scenarios like servers / clusters I don't think we'd necessarily get this information. For example with the proposed Kubernetes integration this would likely be the cluster name which could also have Linux, macOS, and Windows OS nodes.

Maybe something we should be using the Display Name / Description annotations for like in other resources?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Device object is optional, can make the contents optional as well?

Not keen on how un-typed annotations are. Are you suggesting to add this info as an annotation on the connector resource?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattdjenkinson yeah that's what I was recommending. We've been using kubernetes.io/display-name and kubernetes.io/description as annotations on resources to indicate how the resource should be presented to users in the UI.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zachsmith1 do you have an opinion here? I know when we originally discussed this a few weeks ago you weren't keen on just adding it as an annotation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya I was originally suggesting we just use annotations for this data. if we want to make it more of an expected field that sdk/apps set then connector status makes the most sense. doing it at the annotation/label level for now keeps us flexible in the future


// ConnectorConnectionDetails provides details on how to connect to the connector.
//
// +kubebuilder:validation:XValidation:message="publicKey field must be nil if the type is not PublicKey",rule="!(self.type != 'PublicKey' && has(self.publicKey))"
Expand Down Expand Up @@ -160,6 +176,12 @@ type ConnectorStatus struct {
//
// +kubebuilder:validation:Optional
LeaseRef *corev1.LocalObjectReference `json:"leaseRef,omitempty"`

// Device describes the device running the connector, as reported by the
// connector agent.
//
// +kubebuilder:validation:Optional
Device *ConnectorDeviceInfo `json:"device,omitempty"`
}

const (
Expand Down
20 changes: 20 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions config/crd/bases/networking.datumapis.com_connectors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,25 @@ spec:
rule: '!(self.type != ''PublicKey'' && has(self.publicKey))'
- message: publicKey field must be specified if the type is PublicKey
rule: self.type == 'PublicKey' && has(self.publicKey)
device:
description: |-
Device describes the device running the connector, as reported by the
connector agent.
properties:
name:
description: Human-readable name of the device running the connector.
maxLength: 253
minLength: 1
type: string
os:
description: Operating system of the device running the connector.
maxLength: 253
minLength: 1
type: string
required:
- name
- os
type: object
leaseRef:
description: |-
LeaseRef references the Lease used to report connector liveness.
Expand Down
Loading