Skip to content

Commit

Permalink
feat(code): fix test failing
Browse files Browse the repository at this point in the history
  • Loading branch information
budimanjojo committed Sep 2, 2022
1 parent dae1910 commit 3487d47
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 26 deletions.
25 changes: 13 additions & 12 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
23 changes: 12 additions & 11 deletions pkg/config/validate/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/talos/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down
2 changes: 1 addition & 1 deletion pkg/talos/nodeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 3487d47

Please sign in to comment.