mirror of
https://github.com/siderolabs/talos.git
synced 2025-11-28 22:21:34 +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/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"
|
||||
)
|
||||
|
||||
@ -23,6 +25,7 @@ type staticPodStatuses struct {
|
||||
}
|
||||
|
||||
type kubernetesInfoData struct {
|
||||
isControlPlane bool
|
||||
kubernetesVersion string
|
||||
kubeletStatus string
|
||||
|
||||
@ -102,6 +105,8 @@ func (widget *KubernetesInfo) updateNodeData(data resourcedata.Data) {
|
||||
}
|
||||
|
||||
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() {
|
||||
data := widget.getOrCreateNodeData(widget.selectedNode)
|
||||
|
||||
fields := fieldGroup{
|
||||
fields: []field{
|
||||
{
|
||||
fieldList := make([]field, 0, 5)
|
||||
|
||||
fieldList = append(fieldList,
|
||||
field{
|
||||
Name: "KUBERNETES",
|
||||
Value: data.kubernetesVersion,
|
||||
},
|
||||
{
|
||||
field{
|
||||
Name: "KUBELET",
|
||||
Value: data.kubeletStatus,
|
||||
},
|
||||
{
|
||||
})
|
||||
|
||||
if data.isControlPlane {
|
||||
fieldList = append(fieldList,
|
||||
field{
|
||||
Name: "APISERVER",
|
||||
Value: data.podStatuses.apiServer,
|
||||
},
|
||||
{
|
||||
field{
|
||||
Name: "CONTROLLER-MANAGER",
|
||||
Value: data.podStatuses.controllerManager,
|
||||
},
|
||||
{
|
||||
field{
|
||||
Name: "SCHEDULER",
|
||||
Value: data.podStatuses.scheduler,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
fields := fieldGroup{
|
||||
fields: fieldList,
|
||||
}
|
||||
|
||||
widget.SetText(fields.String())
|
||||
|
||||
@ -79,10 +79,11 @@ func (widget *TalosInfo) updateNodeData(data resourcedata.Data) {
|
||||
nodeData.uuid = res.TypedSpec().UUID
|
||||
}
|
||||
case *cluster.Info:
|
||||
if data.Deleted {
|
||||
clusterName := res.TypedSpec().ClusterName
|
||||
if data.Deleted || clusterName == "" {
|
||||
nodeData.clusterName = notAvailable
|
||||
} else {
|
||||
nodeData.clusterName = res.TypedSpec().ClusterName
|
||||
nodeData.clusterName = clusterName
|
||||
}
|
||||
case *runtime.MachineStatus:
|
||||
if data.Deleted {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user