add k9s to server

This commit is contained in:
Michael Jerger 2024-08-09 17:58:18 +02:00
parent 43b7e83187
commit 277302d0ee
4 changed files with 30 additions and 2 deletions

View file

@ -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)

View file

@ -69,6 +69,8 @@ fun Prov.provisionK3s(
if (!k3sConfig.reprovision) {
provisionServerCliConvenience()
}
installK9s()
}
private fun Prov.provisionGrafana(

View file

@ -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,6 +15,7 @@ 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 'alias k9=\"k9s --kubeconfig /etc/kubernetes/admin.conf\"' >> ~/.bashrc")
cmd("echo 'complete -o default -F __start_kubectl k' >> ~/.bashrc")
}

View file

@ -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")
}
}