mirror of https://github.com/linkerd/linkerd2.git
`linkerd install --ha` was only partially applying HA config (#5358)
* `linkerd install --ha` was only partially applying HA config Fixes #5342 `values-ha.yml` contains the specific config for HA, but only the proxy resources controller replicas settings were applied. This PR adds EnablePodAntiafinity, WebhookFailurePolicy and all the resource settings for the other CP pods. Also the `--controller-replicas` flag is moved after the HA flags so it can override the HA settings. Finally, some comments no longer relevant were removed. ## How to test Perform `linkerd install --ha` and make sure the values in `values-ha.yml` are propagated correctly in the produced yaml. ## 2.9.1 After merging to `main`, this should be cherry-picked into the `release/stable-2.9` branch. Co-authored-by: Kevin Leimkuhler <kevin@kleimkuhler.com>
This commit is contained in:
parent
377b38f0bf
commit
35612ae268
|
@ -42,18 +42,14 @@ func makeInstallUpgradeFlags(defaults *l5dcharts.Values) ([]flag.Flag, *pflag.Fl
|
|||
}
|
||||
|
||||
flags := []flag.Flag{
|
||||
flag.NewUintFlag(installUpgradeFlags, "controller-replicas", defaults.ControllerReplicas,
|
||||
"Replicas of the controller to deploy", func(values *l5dcharts.Values, value uint) error {
|
||||
values.ControllerReplicas = value
|
||||
return nil
|
||||
}),
|
||||
|
||||
flag.NewStringFlag(installUpgradeFlags, "controller-log-level", defaults.GetGlobal().ControllerLogLevel,
|
||||
"Log level for the controller and web components", func(values *l5dcharts.Values, value string) error {
|
||||
values.GetGlobal().ControllerLogLevel = value
|
||||
return nil
|
||||
}),
|
||||
|
||||
// The HA flag must be processed before flags that set these values individually so that the
|
||||
// individual flags can override the HA defaults.
|
||||
flag.NewBoolFlag(installUpgradeFlags, "ha", false, "Enable HA deployment config for the control plane (default false)",
|
||||
func(values *l5dcharts.Values, value bool) error {
|
||||
values.GetGlobal().HighAvailability = value
|
||||
|
@ -62,20 +58,20 @@ func makeInstallUpgradeFlags(defaults *l5dcharts.Values) ([]flag.Flag, *pflag.Fl
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// The HA flag must be processed before flags that set these values individually so that the
|
||||
// individual flags can override the HA defaults. This means that the HA flag must appear
|
||||
// before the individual flags in the slice passed to flags.ApplyIfSet.
|
||||
values.ControllerReplicas = haValues.ControllerReplicas
|
||||
values.GetGlobal().Proxy.Resources.CPU.Request = haValues.GetGlobal().Proxy.Resources.CPU.Request
|
||||
values.GetGlobal().Proxy.Resources.Memory.Request = haValues.GetGlobal().Proxy.Resources.Memory.Request
|
||||
// NOTE: CPU Limits are not currently set by default HA charts.
|
||||
//values.Global.Proxy.Cores = haValues.Global.Proxy.Cores
|
||||
//values.Global.Proxy.Resources.CPU.Limit = haValues.Global.Proxy.Resources.CPU.Limit
|
||||
values.GetGlobal().Proxy.Resources.Memory.Limit = haValues.GetGlobal().Proxy.Resources.Memory.Limit
|
||||
*values, err = values.Merge(*haValues)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}),
|
||||
|
||||
flag.NewUintFlag(installUpgradeFlags, "controller-replicas", defaults.ControllerReplicas,
|
||||
"Replicas of the controller to deploy", func(values *l5dcharts.Values, value uint) error {
|
||||
values.ControllerReplicas = value
|
||||
return nil
|
||||
}),
|
||||
|
||||
flag.NewInt64Flag(installUpgradeFlags, "controller-uid", defaults.ControllerUID,
|
||||
"Run the control plane components under this user ID", func(values *l5dcharts.Values, value int64) error {
|
||||
values.ControllerUID = value
|
||||
|
|
|
@ -293,7 +293,7 @@ func readDefaults(chartDir string, ha bool) (*Values, error) {
|
|||
}
|
||||
|
||||
var err error
|
||||
values, err = values.merge(v)
|
||||
values, err = values.Merge(v)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -302,10 +302,10 @@ func readDefaults(chartDir string, ha bool) (*Values, error) {
|
|||
return &values, nil
|
||||
}
|
||||
|
||||
// merge merges the non-empty properties of src into v.
|
||||
// Merge merges the non-empty properties of src into v.
|
||||
// A new Values instance is returned. Neither src nor v are mutated after
|
||||
// calling merge.
|
||||
func (v Values) merge(src Values) (Values, error) {
|
||||
func (v Values) Merge(src Values) (Values, error) {
|
||||
// By default, mergo.Merge doesn't overwrite any existing non-empty values
|
||||
// in its first argument. So in HA mode, we are merging values.yaml into
|
||||
// values-ha.yaml, instead of the other way round (like Helm). This ensures
|
||||
|
|
Loading…
Reference in New Issue