diff --git a/build.py b/build.py index a9e4338..515b700 100644 --- a/build.py +++ b/build.py @@ -131,6 +131,11 @@ def publish_release(project): build.publish_artifacts() +@task +def inst(project): + run("./gradlew inst", shell=True) + + def increase_version_number(project, release_type): build = get_devops_build(project) build.update_release_type(release_type) diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/domain/k3s/K3sService.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/domain/k3s/K3sService.kt index bcee2a7..8cd97ea 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/domain/k3s/K3sService.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/domain/k3s/K3sService.kt @@ -69,6 +69,8 @@ fun Prov.provisionK3s( if (!k3sConfig.reprovision) { provisionServerCliConvenience() } + + installK9s() } private fun Prov.provisionGrafana( diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/CliConvenience.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/CliConvenience.kt index 5accaf0..f48ace2 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/CliConvenience.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/CliConvenience.kt @@ -2,7 +2,6 @@ package org.domaindrivenarchitecture.provs.server.infrastructure import org.domaindrivenarchitecture.provs.framework.core.Prov import org.domaindrivenarchitecture.provs.framework.core.ProvResult -import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createFile import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.createFileFromResource private const val resourcePath = "org/domaindrivenarchitecture/provs/desktop/infrastructure" @@ -16,7 +15,8 @@ fun Prov.provisionServerCliConvenience() = task { fun Prov.provisionKubectlCompletionAndAlias(): ProvResult = task { cmd("kubectl completion bash | sudo tee /etc/bash_completion.d/kubectl > /dev/null") cmd("echo 'alias k=kubectl' >> ~/.bashrc") - cmd("echo 'complete -o default -F __start_kubectl k' >>~/.bashrc") + cmd("echo 'alias k9=\"k9s --kubeconfig /etc/kubernetes/admin.conf\"' >> ~/.bashrc") + cmd("echo 'complete -o default -F __start_kubectl k' >> ~/.bashrc") } fun Prov.provisionVimrc(): ProvResult = task { diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K9s.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K9s.kt new file mode 100644 index 0000000..4288327 --- /dev/null +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K9s.kt @@ -0,0 +1,21 @@ +package org.domaindrivenarchitecture.provs.server.infrastructure + +import org.domaindrivenarchitecture.provs.framework.core.Prov +import org.domaindrivenarchitecture.provs.framework.core.ProvResult +import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.* +import org.domaindrivenarchitecture.provs.framework.ubuntu.web.base.downloadFromURL + +// ----------------------------------- versions -------------------------------- + +const val K9S_VERSION = "v0.32.5" + +// ----------------------------------- public functions -------------------------------- + + +fun Prov.installK9s(): ProvResult { + return taskWithResult { + createDir("/tmp", sudo = true) + downloadFromURL( "https://github.com/derailed/k9s/releases/download/" + K9S_VERSION + "/k9s_linux_amd64.deb", "k9s_linux_amd64.deb", "/tmp") + cmd("sudo dpkg -i k9s_linux_amd64.deb", "/tmp") + } +}