Skip to content

Commit 6bf5f3c

Browse files
committed
feat: support kubeflow 1.9.0
bump go to 1.23.2 bump kind: 0.24.0-gpu, support k8s from 1.26x to 1.31.x *breaking: mv kubectl under node folder to keep each version separated
1 parent 604e6d6 commit 6bf5f3c

27 files changed

+277704
-254
lines changed

cmd/multikf/cmd_add.go

+12-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ package multikf
22

33
import (
44
"errors"
5+
"fmt"
6+
"strings"
57

8+
kfmanifests "github.com/footprintai/multikf/kfmanifests"
9+
"github.com/footprintai/multikf/pkg/k8s"
610
"github.com/footprintai/multikf/pkg/machine"
711
"github.com/footprintai/multikf/pkg/machine/plugins"
812
"github.com/footprintai/multikf/pkg/machine/vagrant"
@@ -62,10 +66,10 @@ func NewAddCommand(logger log.Logger, ioStreams genericclioptions.IOStreams) *co
6266
Workers: withWorkers,
6367
NodeLabels: withLabels,
6468
LocalPath: useLocalPath,
65-
NodeVersion: K8sNodeVersion{
66-
K8sVersion: withK8sVersion,
67-
SHA256: withK8sSHA256,
68-
},
69+
NodeVersion: k8s.NewKindK8sVersion(
70+
withK8sVersion,
71+
withK8sSHA256,
72+
),
6973
})
7074
if err != nil {
7175
return err
@@ -89,13 +93,14 @@ func NewAddCommand(logger log.Logger, ioStreams genericclioptions.IOStreams) *co
8993
return handle(args[0])
9094
},
9195
}
96+
kfVersions := kfmanifests.ListVersions()
9297

9398
cmd.Flags().StringVar(&provisionerStr, "provisioner", "docker", "provisioner, possible value: docker and vagrant")
9499
cmd.Flags().IntVar(&cpus, "cpus", 1, "number of cpus allocated to the guest machine")
95100
cmd.Flags().IntVar(&memoryInG, "memoryg", 1, "number of memory in gigabytes allocated to the guest machine")
96101
cmd.Flags().BoolVar(&forceOverwrite, "f", false, "force to overwrite existing config. (default: false)")
97102
cmd.Flags().BoolVar(&withKubeflow, "with_kubeflow", true, "install kubeflow modules (default: true)")
98-
cmd.Flags().StringVar(&withKubeflowVersion, "kubeflow_version", "v1.7.0", "kubeflow version v1.6.1/v1.7.0")
103+
cmd.Flags().StringVar(&withKubeflowVersion, "kubeflow_version", kfVersions[0], fmt.Sprintf("support kubeflow version: %s", strings.Join(kfVersions, ",")))
99104
cmd.Flags().BoolVar(&withAudit, "with_audit", true, "enable k8s auditing (default: true)")
100105
cmd.Flags().StringVar(&withKubeflowDefaultPassword, "with_password", "12341234", "with a specific password for default user (default: 12341234)")
101106
cmd.Flags().IntVar(&useGPUs, "use_gpus", 0, "use gpu resources (default: 0), possible value (0 or 1)")
@@ -104,8 +109,8 @@ func NewAddCommand(logger log.Logger, ioStreams genericclioptions.IOStreams) *co
104109
cmd.Flags().IntVar(&withWorkers, "with_workers", 0, "use workers (default: 0)")
105110
cmd.Flags().StringVar(&withLabels, "with_labels", "", "attach labels, format: key1=value1,key2=value2(default: )")
106111
cmd.Flags().StringVar(&useLocalPath, "use_localpath", "", "mount local path to kind cluster")
107-
cmd.Flags().StringVar(&withK8sVersion, "with_k8s_version", "v1.27.11", "k8s version, referring to kind")
108-
cmd.Flags().StringVar(&withK8sSHA256, "with_k8s_sha256", "681253009e68069b8e01aad36a1e0fa8cf18bb0ab3e5c4069b2e65cafdd70843", "k8s sha256")
112+
cmd.Flags().StringVar(&withK8sVersion, "with_k8s_version", k8s.DefaultVersion().Version(), fmt.Sprintf("support verisions:%s", strings.Join(k8s.ListVersionString(), ",")))
113+
cmd.Flags().StringVar(&withK8sSHA256, "with_k8s_sha256", k8s.DefaultVersion().Sha256(), fmt.Sprintf("k8s version and its sha256 mapping list:%s", strings.Join(k8s.ListVersionSha256String(), ",")))
109114

110115
return cmd
111116
}

cmd/multikf/helper.go

+15-24
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package multikf
33
import (
44
"encoding/json"
55
"errors"
6-
"fmt"
76
"strconv"
87
"strings"
98

9+
"github.com/footprintai/multikf/pkg/k8s"
1010
"github.com/footprintai/multikf/pkg/machine"
1111
"github.com/footprintai/multikf/pkg/machine/plugins"
1212
"sigs.k8s.io/kind/pkg/log"
@@ -66,27 +66,18 @@ var (
6666

6767
type machineConfig struct {
6868
logger log.Logger
69-
Cpus int `json:"cpus"`
70-
MemoryInG int `json:"memoryInG"`
71-
UseGPUs int `json:useGpus`
72-
KubeAPIIP string `json:"kubeapi_ip"`
73-
ExportPorts string `json:"export_ports"`
74-
DefaultPassword string `json:"default_password"`
75-
ForceOverwrite bool `json:"force_overwrite"`
76-
IsAuditEnabled bool `json:"audit_enabled"`
77-
Workers int `json:"workers"`
78-
NodeLabels string `json:"node_labels"`
79-
LocalPath string `json:"local_path"`
80-
NodeVersion K8sNodeVersion `json:"node_version"`
81-
}
82-
83-
type K8sNodeVersion struct {
84-
K8sVersion string `json:"k8s_version"` // started with v1.26.x
85-
SHA256 string `json:"sha256"`
86-
}
87-
88-
func (k K8sNodeVersion) String() string {
89-
return fmt.Sprintf("kindest/node:%s@sha256:%s", k.K8sVersion, k.SHA256)
69+
Cpus int `json:"cpus"`
70+
MemoryInG int `json:"memoryInG"`
71+
UseGPUs int `json:"useGpus"`
72+
KubeAPIIP string `json:"kubeapi_ip"`
73+
ExportPorts string `json:"export_ports"`
74+
DefaultPassword string `json:"default_password"`
75+
ForceOverwrite bool `json:"force_overwrite"`
76+
IsAuditEnabled bool `json:"audit_enabled"`
77+
Workers int `json:"workers"`
78+
NodeLabels string `json:"node_labels"`
79+
LocalPath string `json:"local_path"`
80+
NodeVersion k8s.KindK8sVersion `json:"node_version"`
9081
}
9182

9283
func (m machineConfig) Info() string {
@@ -95,8 +86,8 @@ func (m machineConfig) Info() string {
9586

9687
}
9788

98-
func (m machineConfig) GetNodeVersion() string {
99-
return m.NodeVersion.String()
89+
func (m machineConfig) GetNodeVersion() k8s.KindK8sVersion {
90+
return m.NodeVersion
10091
}
10192

10293
func (m machineConfig) GetCPUs() int {

go.mod

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module github.com/footprintai/multikf
22

3-
go 1.21
4-
toolchain go1.22.5
3+
go 1.23.2
54

65
require (
76
github.com/bmatcuk/go-vagrant v1.6.0

0 commit comments

Comments
 (0)