Skip to content

Commit

Permalink
Add installation configure of LH GuaranteedInstanceManagerCPU
Browse files Browse the repository at this point in the history
Signed-off-by: Jian Wang <[email protected]>
  • Loading branch information
w13915984028 authored and bk201 committed Apr 18, 2024
1 parent 59add1f commit c0aaf56
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
3 changes: 3 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ type LHDefaultSettings struct {
// 0 is valid, means not setting CPU resources, use pointer to check if it is set
GuaranteedEngineManagerCPU *uint32 `json:"guaranteedEngineManagerCPU,omitempty"`
GuaranteedReplicaManagerCPU *uint32 `json:"guaranteedReplicaManagerCPU,omitempty"`
// from Longhorn v1.5.0, LH merges the above two into one
// the above two are not used afterwards, but Harvester keeps them for compatibility
GuaranteedInstanceManagerCPU *uint32 `json:"guaranteedInstanceManagerCPU,omitempty"`
}

type LonghornChartValues struct {
Expand Down
15 changes: 10 additions & 5 deletions pkg/config/cos.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ const (
ifcfgGlobPattern = networkConfigDirectory + "ifcfg-*"
ifrouteGlobPattern = networkConfigDirectory + "ifroute-*"

bootstrapConfigCount = 6
defaultReplicaCount = 3
defaultGuaranteedEngineManagerCPU = 12 // means percentage 12%
defaultGuaranteedReplicaManagerCPU = 12 // means percentage 12%
defaultSystemImageSize = 3072 // size of /run/initramfs/cos-state/cOS/active.img in MB
bootstrapConfigCount = 6
defaultReplicaCount = 3
defaultGuaranteedEngineManagerCPU = 12 // means percentage 12%
defaultGuaranteedReplicaManagerCPU = 12 // means percentage 12%
defaultGuaranteedInstanceManagerCPU = 12 // means percentage 12%
defaultSystemImageSize = 3072 // size of /run/initramfs/cos-state/cOS/active.img in MB
)

var (
Expand Down Expand Up @@ -280,6 +281,10 @@ func setConfigDefaultValues(config *HarvesterConfig) {
if config.Harvester.Longhorn.DefaultSettings.GuaranteedReplicaManagerCPU != nil && *config.Harvester.Longhorn.DefaultSettings.GuaranteedReplicaManagerCPU > defaultGuaranteedReplicaManagerCPU {
*config.Harvester.Longhorn.DefaultSettings.GuaranteedReplicaManagerCPU = defaultGuaranteedReplicaManagerCPU
}

if config.Harvester.Longhorn.DefaultSettings.GuaranteedInstanceManagerCPU != nil && *config.Harvester.Longhorn.DefaultSettings.GuaranteedInstanceManagerCPU > defaultGuaranteedInstanceManagerCPU {
*config.Harvester.Longhorn.DefaultSettings.GuaranteedInstanceManagerCPU = defaultGuaranteedInstanceManagerCPU
}
}

func initRancherdStage(config *HarvesterConfig, stage *yipSchema.Stage) error {
Expand Down
7 changes: 2 additions & 5 deletions pkg/config/templates/rancherd-10-harvester.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,8 @@ resources:
defaultSettings:
taintToleration: "kubevirt.io/drain:NoSchedule"
defaultDataPath: "/var/lib/harvester/defaultdisk"
{{- if .Harvester.Longhorn.DefaultSettings.GuaranteedEngineManagerCPU }}
guaranteedEngineManagerCPU: {{ .Harvester.Longhorn.DefaultSettings.GuaranteedEngineManagerCPU }}
{{- end }}
{{- if .Harvester.Longhorn.DefaultSettings.GuaranteedReplicaManagerCPU }}
guaranteedReplicaManagerCPU: {{ .Harvester.Longhorn.DefaultSettings.GuaranteedReplicaManagerCPU }}
{{- if .Harvester.Longhorn.DefaultSettings.GuaranteedInstanceManagerCPU }}
guaranteedInstanceManagerCPU: {{ .Harvester.Longhorn.DefaultSettings.GuaranteedInstanceManagerCPU }}
{{- end }}
harvester-network-controller:
enabled: true
Expand Down

0 comments on commit c0aaf56

Please sign in to comment.