Skip to content

Commit

Permalink
docs(options): Slightly improve comments for the NodeType set type
Browse files Browse the repository at this point in the history
  • Loading branch information
LaikaN57 authored Jun 6, 2024
1 parent 7995d5f commit aceea80
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/options/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ func (r *ResourceSet) Type() string {
return "string"
}

// NodeType represents a nodeName to query from.
// NodeType represents a set of nodeNames to query from.
type NodeType map[string]struct{}

// Set converts a comma-separated string of nodename into a slice and appends it to the NodeList
// Set splits a comma-separated string of nodeNames and appends them to the NodeType set
func (n *NodeType) Set(value string) error {
s := *n
cols := strings.Split(value, ",")
Expand All @@ -121,7 +121,7 @@ func (n *NodeType) Set(value string) error {
return nil
}

// AsSlice returns the LabelsAllowList in the form of plain string slice.
// AsSlice returns the NodeType set in the form of a plain string slice.
func (n NodeType) AsSlice() []string {
cols := make([]string, 0, len(n))
for col := range n {
Expand All @@ -130,16 +130,17 @@ func (n NodeType) AsSlice() []string {
return cols
}

// String returns the NodeType set in the form of a comma-separated string.
func (n NodeType) String() string {
return strings.Join(n.AsSlice(), ",")
}

// Type returns a descriptive string about the NodeList type.
// Type returns a descriptive string about the NodeType set type.
func (n *NodeType) Type() string {
return "string"
}

// GetNodeFieldSelector returns a nodename field selector.
// GetNodeFieldSelector returns a nodeName field selector.
func (n *NodeType) GetNodeFieldSelector() string {
if nil == n || len(*n) == 0 {
klog.InfoS("Using node type is nil")
Expand Down

0 comments on commit aceea80

Please sign in to comment.