@@ -11,6 +11,7 @@ import (
11
11
coreV1 "k8s.io/api/core/v1"
12
12
"k8s.io/apimachinery/pkg/api/resource"
13
13
14
+ "github.com/baetyl/baetyl-go/v2/context"
14
15
"github.com/baetyl/baetyl-go/v2/errors"
15
16
"github.com/baetyl/baetyl-go/v2/log"
16
17
)
@@ -82,6 +83,7 @@ type NodeView struct {
82
83
Labels map [string ]string `json:"labels,omitempty" yaml:"labels,omitempty"`
83
84
Annotations map [string ]string `json:"annotations,omitempty" yaml:"annotations,omitempty"`
84
85
Report * ReportView `json:"report,omitempty" yaml:"report,omitempty"`
86
+ AppMode string `json:"appMode,omitempty" yaml:"appMode,omitempty"`
85
87
Desire Desire `json:"desire,omitempty" yaml:"desire,omitempty"`
86
88
SysApps []string `json:"sysApps,omitempty" yaml:"sysApps,omitempty"`
87
89
Description string `json:"description,omitempty" yaml:"description,omitempty"`
@@ -299,6 +301,7 @@ func (n *Node) View(timeout time.Duration) (*NodeView, error) {
299
301
}
300
302
}
301
303
report .countInstanceNum ()
304
+ view .AppMode = report .calculateAppMode ()
302
305
}
303
306
return view , nil
304
307
}
@@ -454,6 +457,15 @@ func (s *NodeStats) processResourcePercent(status *NodeStats, resourceType strin
454
457
return "0" , nil
455
458
}
456
459
460
+ func (view * ReportView ) calculateAppMode () string {
461
+ for _ , node := range view .Node {
462
+ if node .ContainerRuntime == "" && node .MachineID == "" {
463
+ return context .RunModeNative
464
+ }
465
+ }
466
+ return context .RunModeKube
467
+ }
468
+
457
469
func (view * ReportView ) countInstanceNum () {
458
470
nums := map [string ]int {}
459
471
if view .AppStats != nil {
0 commit comments