Documentation
¶
Overview ¶
Package node implements `olares-cli cluster node ...` — cluster node inspection visible to the active profile.
Like every other verb in the cluster tree, server-side scoping decides what's visible (e.g. a non-admin profile may receive an empty list or 403 when listing nodes). CLI never gates locally; see olares-cluster SKILL.md for the security rationale.
This is the per-user K8s view of nodes — for host-side node install / join / drain operations see `olares-cli node` (the kubeconfig-based tree).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGetCommand ¶
NewGetCommand: `olares-cli cluster node get <name> [-o table|json]`.
Calls SPA's getNodeDetail (apps/packages/app/src/apps/controlPanelCommon/network/index.ts:164): `/kapis/resources.kubesphere.io/v1alpha3/nodes/<node>` — returns the K8s native Node object (no envelope; KubeSphere's per-resource detail just forwards the upstream shape).
func NewListCommand ¶
NewListCommand: `olares-cli cluster node list [-l SEL] [--limit N] [--page N] [--all] [-o table|json]`.
Calls SPA's getNodesList (apps/packages/app/src/apps/controlPanelCommon/network/index.ts:46): `/kapis/resources.kubesphere.io/v1alpha3/nodes`. Server-side scoping decides what's visible.
Types ¶
type Node ¶
type Node struct {
Kind string `json:"kind,omitempty"`
APIVersion string `json:"apiVersion,omitempty"`
Metadata struct {
Name string `json:"name"`
UID string `json:"uid,omitempty"`
CreationTimestamp string `json:"creationTimestamp,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
} `json:"metadata"`
Spec struct {
Unschedulable bool `json:"unschedulable,omitempty"`
Taints []NodeTaint `json:"taints,omitempty"`
} `json:"spec,omitempty"`
Status struct {
Conditions []NodeCondition `json:"conditions,omitempty"`
Addresses []NodeAddress `json:"addresses,omitempty"`
NodeInfo NodeInfo `json:"nodeInfo,omitempty"`
Capacity map[string]string `json:"capacity,omitempty"`
Allocatable map[string]string `json:"allocatable,omitempty"`
} `json:"status,omitempty"`
}
Node is the minimal corev1.Node + status subset rendered by the cluster node verbs. Mirrors the projection KubeSphere returns from /kapis/resources.kubesphere.io/v1alpha3/nodes.
func (Node) InternalIP ¶
InternalIP returns the first InternalIP address (matches kubectl behavior). Falls back to ExternalIP, then "-".
func (Node) KubeletVersion ¶
KubeletVersion is a small accessor — keeps the rendering code in list.go / get.go from poking deep into Status.NodeInfo.
func (Node) Roles ¶
Roles returns the comma-joined list of node roles, derived from the standard `node-role.kubernetes.io/<role>` label key prefix. Empty (no role labels) → "<none>" (matches `kubectl get nodes`).
func (Node) StatusLabel ¶
StatusLabel returns the kubectl-style STATUS column.
- "Ready" when conditions[type=Ready].status == "True" and the node is schedulable.
- "Ready,SchedulingDisabled" when Ready=True but spec.unschedulable=true (cordoned).
- "NotReady" when Ready=False or Unknown.
- "Unknown" when no Ready condition is present at all.
Named with the "Label" suffix because Status() would shadow the `Status` field on the same struct.
type NodeAddress ¶
type NodeCondition ¶
type NodeInfo ¶
type NodeInfo struct {
OSImage string `json:"osImage,omitempty"`
KernelVersion string `json:"kernelVersion,omitempty"`
Architecture string `json:"architecture,omitempty"`
OperatingSystem string `json:"operatingSystem,omitempty"`
KubeletVersion string `json:"kubeletVersion,omitempty"`
ContainerRuntimeVersion string `json:"containerRuntimeVersion,omitempty"`
}