Skip to content

Commit

Permalink
chore: support kbcli cluster update (#7015)
Browse files Browse the repository at this point in the history
  • Loading branch information
sophon-zt committed Apr 23, 2024
1 parent 6aa6a2d commit 912b51c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pkg/cmd/cluster/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ func (o *UpdateOptions) buildPatch() error {
"tolerations": {field: "tolerations", obj: spec, fn: buildTolObj},

// monitor and logs
"monitoring-interval": {field: "monitor", obj: nil, fn: buildComps},
"enable-all-logs": {field: "enable-all-logs", obj: nil, fn: buildComps},
"monitor-enabled": {field: "monitor", obj: nil, fn: buildComps},
"enable-all-logs": {field: "enable-all-logs", obj: nil, fn: buildComps},

// backup config
"backup-enabled": {field: "enabled", obj: nil, fn: buildBackup},
Expand Down Expand Up @@ -603,13 +603,16 @@ func buildLogsReconfiguringOps(clusterName, namespace, compName, configName, key
}

func (o *UpdateOptions) updateMonitor(val string) error {
intVal, err := strconv.ParseInt(val, 10, 32)
enabled, err := strconv.ParseBool(val)
if err != nil {
return err
}

for i := range o.cluster.Spec.ComponentSpecs {
o.cluster.Spec.ComponentSpecs[i].Monitor = intVal != 0
// TODO: update kb version depend
// 1. add metrics sidecar to the component
// 2. enable monitor
o.cluster.Spec.ComponentSpecs[i].Monitor = enabled
}
return nil
}
Expand Down

0 comments on commit 912b51c

Please sign in to comment.