Skip to content

Commit 11f0392

Browse files
feat: stop forcing installs and upload binary (#80)
this commit makes upload binary option to be true only in air gap environments and removes a --force flag reminiscent from a test.
1 parent 34c39af commit 11f0392

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

cmd/helmvm/install.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,9 @@ func ensureK0sctlConfig(c *cli.Context, nodes []infra.Node, useprompt bool) erro
239239
if err != nil {
240240
return fmt.Errorf("unable to render config: %w", err)
241241
}
242+
if bundledir != "" {
243+
config.SetUploadBinary(cfg)
244+
}
242245
if err := config.UpdateHostsFiles(cfg, bundledir); err != nil {
243246
return fmt.Errorf("unable to update hosts files: %w", err)
244247
}

pkg/config/config.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ func ReadConfigFile(cfgPath string) (*v1beta1.Cluster, error) {
4444
return &cfg, nil
4545
}
4646

47+
// SetUploadBinary sets the upload binary config to true in all hosts in the provided configuration.
48+
func SetUploadBinary(config *v1beta1.Cluster) {
49+
for i := range config.Spec.Hosts {
50+
config.Spec.Hosts[i].UploadBinary = true
51+
}
52+
}
53+
4754
// RenderClusterConfig renders a cluster configuration interactively.
4855
func RenderClusterConfig(ctx context.Context, nodes []infra.Node, multi bool) (*v1beta1.Cluster, error) {
4956
if multi {

pkg/config/host.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ type hostcfg struct {
2323

2424
// render returns a cluster.Host from the given config.
2525
func (h *hostcfg) render() *cluster.Host {
26-
ifls := []string{"--force", "--disable-components konnectivity-server"}
27-
if h.Role == "worker" {
28-
ifls = []string{"--force"}
26+
var ifls []string
27+
if h.Role != "worker" {
28+
ifls = []string{"--disable-components konnectivity-server"}
2929
}
3030
return &cluster.Host{
3131
Role: h.Role,
32-
UploadBinary: true,
32+
UploadBinary: false,
3333
NoTaints: h.Role == "controller+worker",
3434
InstallFlags: ifls,
3535
Connection: rig.Connection{

0 commit comments

Comments
 (0)