add kubernetes version selector

pull/14025/head
Steven Powell 2022-04-22 13:38:04 -07:00
parent 2a0ea2eecb
commit ada44dd599
2 changed files with 14 additions and 9 deletions

View File

@ -566,6 +566,7 @@ static int cpus = 2;
static int memory = 2400; static int memory = 2400;
static QString driver = ""; static QString driver = "";
static QString containerRuntime = ""; static QString containerRuntime = "";
static QString k8sVersion = "";
void Window::askName() void Window::askName()
{ {
@ -603,24 +604,21 @@ void Window::askCustom()
QFormLayout form(&dialog); QFormLayout form(&dialog);
driverComboBox = new QComboBox; driverComboBox = new QComboBox;
driverComboBox->addItem("docker"); driverComboBox->addItems({ "docker", "virtualbox", "vmware", "podman" });
#if __linux__ #if __linux__
driverComboBox->addItem("kvm2"); driverComboBox->addItem("kvm2");
#elif __APPLE__ #elif __APPLE__
driverComboBox->addItem("hyperkit"); driverComboBox->addItems({ "hyperkit", "parallels" });
driverComboBox->addItem("parallels");
#else #else
driverComboBox->addItem("hyperv"); driverComboBox->addItem("hyperv");
#endif #endif
driverComboBox->addItem("virtualbox");
driverComboBox->addItem("vmware");
driverComboBox->addItem("podman");
form.addRow(new QLabel(tr("Driver")), driverComboBox); form.addRow(new QLabel(tr("Driver")), driverComboBox);
containerRuntimeComboBox = new QComboBox; containerRuntimeComboBox = new QComboBox;
containerRuntimeComboBox->addItem("docker"); containerRuntimeComboBox->addItems({ "docker", "containerd", "crio" });
containerRuntimeComboBox->addItem("containerd");
containerRuntimeComboBox->addItem("crio");
form.addRow(new QLabel(tr("Container Runtime")), containerRuntimeComboBox); form.addRow(new QLabel(tr("Container Runtime")), containerRuntimeComboBox);
k8sVersionComboBox = new QComboBox;
k8sVersionComboBox->addItems({ "stable", "latest", "none" });
form.addRow(new QLabel(tr("Kubernetes Version")), k8sVersionComboBox);
QLineEdit cpuField(QString::number(cpus), &dialog); QLineEdit cpuField(QString::number(cpus), &dialog);
form.addRow(new QLabel(tr("CPUs")), &cpuField); form.addRow(new QLabel(tr("CPUs")), &cpuField);
QLineEdit memoryField(QString::number(memory), &dialog); QLineEdit memoryField(QString::number(memory), &dialog);
@ -638,6 +636,10 @@ void Window::askCustom()
driver = driverComboBox->itemText(driverComboBox->currentIndex()); driver = driverComboBox->itemText(driverComboBox->currentIndex());
containerRuntime = containerRuntime =
containerRuntimeComboBox->itemText(containerRuntimeComboBox->currentIndex()); containerRuntimeComboBox->itemText(containerRuntimeComboBox->currentIndex());
k8sVersion = k8sVersionComboBox->itemText(k8sVersionComboBox->currentIndex());
if (k8sVersion == "none") {
k8sVersion = "v0.0.0";
}
cpus = cpuField.text().toInt(); cpus = cpuField.text().toInt();
memory = memoryField.text().toInt(); memory = memoryField.text().toInt();
QStringList args = { "-p", QStringList args = { "-p",
@ -646,6 +648,8 @@ void Window::askCustom()
driver, driver,
"--container-runtime", "--container-runtime",
containerRuntime, containerRuntime,
"--kubernetes-version",
k8sVersion,
"--cpus", "--cpus",
QString::number(cpus), QString::number(cpus),
"--memory", "--memory",

View File

@ -154,6 +154,7 @@ private:
void askName(); void askName();
QComboBox *driverComboBox; QComboBox *driverComboBox;
QComboBox *containerRuntimeComboBox; QComboBox *containerRuntimeComboBox;
QComboBox *k8sVersionComboBox;
// Commands // Commands
void startMinikube(QStringList args); void startMinikube(QStringList args);