From 3487d471eaf2995ca1b6396fffaa7e4f9ef05467 Mon Sep 17 00:00:00 2001 From: budimanjojo Date: Fri, 2 Sep 2022 09:20:46 +0700 Subject: [PATCH] feat(code): fix test failing --- pkg/config/config.go | 25 +++++++++++++------------ pkg/config/validate/config.go | 23 ++++++++++++----------- pkg/talos/input.go | 4 ++-- pkg/talos/nodeconfig.go | 2 +- 4 files changed, 28 insertions(+), 26 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index a02f9b21..0acb2a4d 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -3,18 +3,19 @@ package config import "github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1" type TalhelperConfig struct { - ClusterName string `yaml:"clusterName"` - TalosVersion string `yaml:"talosVersion,omitempty"` - KubernetesVersion string `yaml:"kubernetesVersion,omitempty"` - Endpoint string `yaml:"endpoint"` - Domain string `yaml:"domain,omitempty"` - AllowSchedulingOnMasters bool `yaml:"allowSchedulingOnMasters,omitempty"` - ClusterPodNets []string `yaml:"clusterPodNets,omitempty"` - ClusterSvcNets []string `yaml:"clusterSvcNets,omitempty"` - CNIConfig cniConfig `yaml:"cniConfig,omitempty"` - Nodes []Nodes `yaml:"nodes"` - ControlPlane controlPlane `yaml:"controlPlane,omitempty"` - Worker worker `yaml:"worker,omitempty"` + ClusterName string `yaml:"clusterName"` + TalosVersion string `yaml:"talosVersion,omitempty"` + KubernetesVersion string `yaml:"kubernetesVersion,omitempty"` + Endpoint string `yaml:"endpoint"` + Domain string `yaml:"domain,omitempty"` + AllowSchedulingOnMasters bool `yaml:"allowSchedulingOnMasters,omitempty"` + AllowSchedulingOnControlPlanes bool `yaml:"allowSchedulingOnControlPlanes,omitempty"` + ClusterPodNets []string `yaml:"clusterPodNets,omitempty"` + ClusterSvcNets []string `yaml:"clusterSvcNets,omitempty"` + CNIConfig cniConfig `yaml:"cniConfig,omitempty"` + Nodes []Nodes `yaml:"nodes"` + ControlPlane controlPlane `yaml:"controlPlane,omitempty"` + Worker worker `yaml:"worker,omitempty"` } type Nodes struct { diff --git a/pkg/config/validate/config.go b/pkg/config/validate/config.go index bd9ec38a..1627fa32 100644 --- a/pkg/config/validate/config.go +++ b/pkg/config/validate/config.go @@ -7,17 +7,18 @@ import ( ) type Config struct { - ClusterName string `validate:"required"` - TalosVersion string `validate:"isVersion"` - KubernetesVersion string `validate:"isVersion"` - Endpoint string `validate:"isTalosEndpoint"` - Domain string `validate:"isDomain"` - AllowSchedulingOnMasters string `validate:"isBool"` - ClusterPodNets []string `validate:"isCIDRList"` - ClusterSvcNets []string `validate:"isCIDRList"` - CniConfig *CNIConfig - Nodes []*Node - ControlPlane struct { + ClusterName string `validate:"required"` + TalosVersion string `validate:"isVersion"` + KubernetesVersion string `validate:"isVersion"` + Endpoint string `validate:"isTalosEndpoint"` + Domain string `validate:"isDomain"` + AllowSchedulingOnMasters string `validate:"isBool"` + AllowSchedulingOnControlPlanes string `validate:"isBool"` + ClusterPodNets []string `validate:"isCIDRList"` + ClusterSvcNets []string `validate:"isCIDRList"` + CniConfig *CNIConfig + Nodes []*Node + ControlPlane struct { ConfigPatches []map[string]interface{} `validate:"isRFC6902List"` } Worker struct { diff --git a/pkg/talos/input.go b/pkg/talos/input.go index 65628430..7a6cfff5 100644 --- a/pkg/talos/input.go +++ b/pkg/talos/input.go @@ -39,8 +39,8 @@ func parseOptions(c *config.TalhelperConfig, vc *tconfig.VersionContract) []gene opts = append(opts, generate.WithVersionContract(vc)) opts = append(opts, generate.WithInstallImage(c.GetInstallerURL())) - if c.AllowSchedulingOnMasters { - opts = append(opts, generate.WithAllowSchedulingOnMasters(c.AllowSchedulingOnMasters)) + if c.AllowSchedulingOnMasters || c.AllowSchedulingOnControlPlanes { + opts = append(opts, generate.WithAllowSchedulingOnControlPlanes(true)) } if c.CNIConfig.Name != "" { diff --git a/pkg/talos/nodeconfig.go b/pkg/talos/nodeconfig.go index 32d1feff..7a11d4cb 100644 --- a/pkg/talos/nodeconfig.go +++ b/pkg/talos/nodeconfig.go @@ -50,7 +50,7 @@ func applyNodeOverride(node *config.Nodes, cfg *v1alpha1.Config) (*v1alpha1.Conf } if node.DisableSearchDomain { - cfg.MachineConfig.MachineNetwork.NetworkDisableSearchDomain = node.DisableSearchDomain + cfg.MachineConfig.MachineNetwork.NetworkDisableSearchDomain = &node.DisableSearchDomain } if len(node.NetworkInterfaces) != 0 {