mirror of
https://github.com/siderolabs/talos.git
synced 2025-11-29 06:31:14 +01:00
fix: do not show control plane status for workers on dashboard
Hide kube-apiserver, kube-controller-manager and kube-scheduler statuses on the dashboard for the worker nodes, instead of showing them as n/a. Also display the cluster name as n/a for workers (instead of an empty string), as that information is not available to them. Closes siderolabs/talos#7103. Signed-off-by: Utku Ozdemir <utku.ozdemir@siderolabs.com>
This commit is contained in:
parent
e5491ddade
commit
2d824b5639
@ -13,6 +13,8 @@ import (
|
|||||||
|
|
||||||
"github.com/siderolabs/talos/internal/pkg/dashboard/apidata"
|
"github.com/siderolabs/talos/internal/pkg/dashboard/apidata"
|
||||||
"github.com/siderolabs/talos/internal/pkg/dashboard/resourcedata"
|
"github.com/siderolabs/talos/internal/pkg/dashboard/resourcedata"
|
||||||
|
"github.com/siderolabs/talos/pkg/machinery/config/types/v1alpha1/machine"
|
||||||
|
"github.com/siderolabs/talos/pkg/machinery/resources/config"
|
||||||
"github.com/siderolabs/talos/pkg/machinery/resources/k8s"
|
"github.com/siderolabs/talos/pkg/machinery/resources/k8s"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,6 +25,7 @@ type staticPodStatuses struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type kubernetesInfoData struct {
|
type kubernetesInfoData struct {
|
||||||
|
isControlPlane bool
|
||||||
kubernetesVersion string
|
kubernetesVersion string
|
||||||
kubeletStatus string
|
kubeletStatus string
|
||||||
|
|
||||||
@ -102,6 +105,8 @@ func (widget *KubernetesInfo) updateNodeData(data resourcedata.Data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
nodeData.podStatuses = widget.staticPodStatuses(maps.Values(nodeData.staticPodStatusMap))
|
nodeData.podStatuses = widget.staticPodStatuses(maps.Values(nodeData.staticPodStatusMap))
|
||||||
|
case *config.MachineType:
|
||||||
|
nodeData.isControlPlane = !data.Deleted && res.MachineType() == machine.TypeControlPlane
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,29 +147,36 @@ func (widget *KubernetesInfo) getOrCreateNodeData(node string) *kubernetesInfoDa
|
|||||||
func (widget *KubernetesInfo) redraw() {
|
func (widget *KubernetesInfo) redraw() {
|
||||||
data := widget.getOrCreateNodeData(widget.selectedNode)
|
data := widget.getOrCreateNodeData(widget.selectedNode)
|
||||||
|
|
||||||
fields := fieldGroup{
|
fieldList := make([]field, 0, 5)
|
||||||
fields: []field{
|
|
||||||
{
|
fieldList = append(fieldList,
|
||||||
Name: "KUBERNETES",
|
field{
|
||||||
Value: data.kubernetesVersion,
|
Name: "KUBERNETES",
|
||||||
},
|
Value: data.kubernetesVersion,
|
||||||
{
|
},
|
||||||
Name: "KUBELET",
|
field{
|
||||||
Value: data.kubeletStatus,
|
Name: "KUBELET",
|
||||||
},
|
Value: data.kubeletStatus,
|
||||||
{
|
})
|
||||||
|
|
||||||
|
if data.isControlPlane {
|
||||||
|
fieldList = append(fieldList,
|
||||||
|
field{
|
||||||
Name: "APISERVER",
|
Name: "APISERVER",
|
||||||
Value: data.podStatuses.apiServer,
|
Value: data.podStatuses.apiServer,
|
||||||
},
|
},
|
||||||
{
|
field{
|
||||||
Name: "CONTROLLER-MANAGER",
|
Name: "CONTROLLER-MANAGER",
|
||||||
Value: data.podStatuses.controllerManager,
|
Value: data.podStatuses.controllerManager,
|
||||||
},
|
},
|
||||||
{
|
field{
|
||||||
Name: "SCHEDULER",
|
Name: "SCHEDULER",
|
||||||
Value: data.podStatuses.scheduler,
|
Value: data.podStatuses.scheduler,
|
||||||
},
|
})
|
||||||
},
|
}
|
||||||
|
|
||||||
|
fields := fieldGroup{
|
||||||
|
fields: fieldList,
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.SetText(fields.String())
|
widget.SetText(fields.String())
|
||||||
|
|||||||
@ -79,10 +79,11 @@ func (widget *TalosInfo) updateNodeData(data resourcedata.Data) {
|
|||||||
nodeData.uuid = res.TypedSpec().UUID
|
nodeData.uuid = res.TypedSpec().UUID
|
||||||
}
|
}
|
||||||
case *cluster.Info:
|
case *cluster.Info:
|
||||||
if data.Deleted {
|
clusterName := res.TypedSpec().ClusterName
|
||||||
|
if data.Deleted || clusterName == "" {
|
||||||
nodeData.clusterName = notAvailable
|
nodeData.clusterName = notAvailable
|
||||||
} else {
|
} else {
|
||||||
nodeData.clusterName = res.TypedSpec().ClusterName
|
nodeData.clusterName = clusterName
|
||||||
}
|
}
|
||||||
case *runtime.MachineStatus:
|
case *runtime.MachineStatus:
|
||||||
if data.Deleted {
|
if data.Deleted {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user