Skip to content

Commit

Permalink
feat: support kubeflow 1.9.0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hsinhoyeh committed Oct 19, 2024
1 parent 604e6d6 commit 7f631fa
Show file tree
Hide file tree
Showing 31 changed files with 277,743 additions and 276 deletions.
19 changes: 12 additions & 7 deletions cmd/multikf/cmd_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ package multikf

import (
"errors"
"fmt"
"strings"

kfmanifests "github.com/footprintai/multikf/kfmanifests"
"github.com/footprintai/multikf/pkg/k8s"
"github.com/footprintai/multikf/pkg/machine"
"github.com/footprintai/multikf/pkg/machine/plugins"
"github.com/footprintai/multikf/pkg/machine/vagrant"
Expand Down Expand Up @@ -62,10 +66,10 @@ func NewAddCommand(logger log.Logger, ioStreams genericclioptions.IOStreams) *co
Workers: withWorkers,
NodeLabels: withLabels,
LocalPath: useLocalPath,
NodeVersion: K8sNodeVersion{
K8sVersion: withK8sVersion,
SHA256: withK8sSHA256,
},
NodeVersion: k8s.NewKindK8sVersion(
withK8sVersion,
withK8sSHA256,
),
})
if err != nil {
return err
Expand All @@ -89,13 +93,14 @@ func NewAddCommand(logger log.Logger, ioStreams genericclioptions.IOStreams) *co
return handle(args[0])
},
}
kfVersions := kfmanifests.ListVersions()

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

return cmd
}
39 changes: 15 additions & 24 deletions cmd/multikf/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package multikf
import (
"encoding/json"
"errors"
"fmt"
"strconv"
"strings"

"github.com/footprintai/multikf/pkg/k8s"
"github.com/footprintai/multikf/pkg/machine"
"github.com/footprintai/multikf/pkg/machine/plugins"
"sigs.k8s.io/kind/pkg/log"
Expand Down Expand Up @@ -66,27 +66,18 @@ var (

type machineConfig struct {
logger log.Logger
Cpus int `json:"cpus"`
MemoryInG int `json:"memoryInG"`
UseGPUs int `json:useGpus`
KubeAPIIP string `json:"kubeapi_ip"`
ExportPorts string `json:"export_ports"`
DefaultPassword string `json:"default_password"`
ForceOverwrite bool `json:"force_overwrite"`
IsAuditEnabled bool `json:"audit_enabled"`
Workers int `json:"workers"`
NodeLabels string `json:"node_labels"`
LocalPath string `json:"local_path"`
NodeVersion K8sNodeVersion `json:"node_version"`
}

type K8sNodeVersion struct {
K8sVersion string `json:"k8s_version"` // started with v1.26.x
SHA256 string `json:"sha256"`
}

func (k K8sNodeVersion) String() string {
return fmt.Sprintf("kindest/node:%s@sha256:%s", k.K8sVersion, k.SHA256)
Cpus int `json:"cpus"`
MemoryInG int `json:"memoryInG"`
UseGPUs int `json:"useGpus"`
KubeAPIIP string `json:"kubeapi_ip"`
ExportPorts string `json:"export_ports"`
DefaultPassword string `json:"default_password"`
ForceOverwrite bool `json:"force_overwrite"`
IsAuditEnabled bool `json:"audit_enabled"`
Workers int `json:"workers"`
NodeLabels string `json:"node_labels"`
LocalPath string `json:"local_path"`
NodeVersion k8s.KindK8sVersion `json:"node_version"`
}

func (m machineConfig) Info() string {
Expand All @@ -95,8 +86,8 @@ func (m machineConfig) Info() string {

}

func (m machineConfig) GetNodeVersion() string {
return m.NodeVersion.String()
func (m machineConfig) GetNodeVersion() k8s.KindK8sVersion {
return m.NodeVersion
}

func (m machineConfig) GetCPUs() int {
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module github.com/footprintai/multikf

go 1.21
toolchain go1.22.5
go 1.23.2

require (
github.com/bmatcuk/go-vagrant v1.6.0
Expand Down
Loading

0 comments on commit 7f631fa

Please sign in to comment.