Skip to content

Commit

Permalink
feat: add capacity for kubelet
Browse files Browse the repository at this point in the history
  • Loading branch information
Szy0127 committed May 29, 2023
1 parent 6a38b6a commit 175f106
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmd/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ var KubeletConfig = kubelet.Config{
IP: "192.168.1.14",
Labels: map[string]string{},
ListenAddr: "localhost:10250",
CPU: "2",
Memory: "3Gi",
}

func initConfig() {
Expand Down
4 changes: 3 additions & 1 deletion config/kubelet-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ FlannelSubnet : 10.2.9.1/24
IP : 192.168.1.14
Labels :
- resource : gpu
ListenAddr : 192.168.1.14:10250
ListenAddr : 192.168.1.14:10250
CPU: "2"
Memory: "3Gi"
8 changes: 8 additions & 0 deletions pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ type Kubelet struct {
IP string //host ip
Labels map[string]string // for nodeSelector
ListenAddr string //MetricsServer listen for auto-scaling
CPU string
Memory string
Server *metricsserver.MetricsServer
}

Expand All @@ -30,6 +32,8 @@ func NewKubelet(config Config) *Kubelet {
IP: config.IP,
Labels: config.Labels,
ListenAddr: config.ListenAddr,
CPU: config.CPU,
Memory: config.Memory,
Server: metricsserver.NewMetricsServer(),
}
}
Expand All @@ -48,6 +52,10 @@ func (kl *Kubelet) register() {
PodCIDR: kl.FlannelSubnet,
},
Status: apiobject.NodeStatus{
Capability:map[string]string{
"cpu":kl.CPU,
"memory":kl.Memory,
}
Addresses: []apiobject.Address{
{
Type: "InternalIP",
Expand Down

0 comments on commit 175f106

Please sign in to comment.