From: adithyasunil26 Date: Wed, 17 Mar 2021 11:14:15 +0000 (+0400) Subject: add kind X-Git-Url: https://git.josue.xyz/?p=webi-installers%2F.git;a=commitdiff_plain;h=4bc553e6baa58da0d9a8b06a197d2b2c276db9b2 add kind --- diff --git a/kind/README.md b/kind/README.md new file mode 100644 index 0000000..648a3b3 --- /dev/null +++ b/kind/README.md @@ -0,0 +1,20 @@ +--- +title: kind +homepage: https://github.com/kubernetes-sigs/kind +tagline: | + kind: tool for running local Kubernetes clusters using Docker container "nodes". +--- + +To update or switch versions, run `webi kind@stable` (or `@v2`, `@beta`,etc). + +## Cheat Sheet + +To create a cluster +```bash +kind create cluster +``` + +To delete a cluster +```bash +kind delete cluster +``` \ No newline at end of file diff --git a/kind/install.ps1 b/kind/install.ps1 new file mode 100644 index 0000000..f55ac27 --- /dev/null +++ b/kind/install.ps1 @@ -0,0 +1,46 @@ +#!/usr/bin/env pwsh + +################## +# Install kind # +################## + +$pkg_cmd_name = "kind" + +$pkg_dst_cmd = "$Env:USERPROFILE\.local\bin\kind.exe" +$pkg_dst = "$pkg_dst_cmd" + +$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\kind-v$Env:WEBI_VERSION\bin\kind.exe" +$pkg_src_bin = "$Env:USERPROFILE\.local\opt\kind-v$Env:WEBI_VERSION\bin" +$pkg_src_dir = "$Env:USERPROFILE\.local\opt\kind-v$Env:WEBI_VERSION" +$pkg_src = "$pkg_src_cmd" + +$pkg_download = "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" + +IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE")) +{ + echo "Downloading kind from $Env:WEBI_PKG_URL to $pkg_download" + & curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part" + & move "$pkg_download.part" "$pkg_download" +} + +IF (!(Test-Path -Path "$pkg_src_cmd")) +{ + echo "Installing kind" + pushd .local\tmp + + Remove-Item -Path ".\kind-v*" -Recurse -ErrorAction Ignore + Remove-Item -Path ".\kind.exe" -Recurse -ErrorAction Ignore + + echo "Unpacking $pkg_download" + & tar xf "$pkg_download" + + echo "Install Location: $pkg_src_cmd" + New-Item "$pkg_src_bin" -ItemType Directory -Force + Move-Item -Path ".\kind-*\kind.exe" -Destination "$pkg_src_bin" + + popd +} + +echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'" +Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore +Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse diff --git a/kind/install.sh b/kind/install.sh new file mode 100644 index 0000000..61a3181 --- /dev/null +++ b/kind/install.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +function __init_kind() { + set -e + set -u + + ################## + # Install kind # + ################## + + pkg_cmd_name="kind" + + pkg_dst_cmd="$HOME/.local/bin/kind" + pkg_dst="$pkg_dst_cmd" + + pkg_src_cmd="$HOME/.local/opt/kind-v$WEBI_VERSION/bin/kind" + pkg_src_dir="$HOME/.local/opt/kind-v$WEBI_VERSION" + pkg_src="$pkg_src_cmd" + + pkg_install() { + mkdir -p "$(dirname $pkg_src_cmd)" + mv ./kind-*/kind "$pkg_src_cmd" + } + + pkg_get_current_version() { + echo $(kind --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + } + +} + +__init_kind diff --git a/kind/releases.js b/kind/releases.js new file mode 100644 index 0000000..b6c7636 --- /dev/null +++ b/kind/releases.js @@ -0,0 +1,28 @@ +'use strict'; + +var github = require('../_common/github.js'); +var owner = 'kubernetes-sigs'; +var repo = 'kind'; + +/******************************************************************************/ +/** Note: Delete this Comment! **/ +/** **/ +/** Need a an example that filters out miscellaneous release files? **/ +/** See `deno`, `gitea`, or `caddy` **/ +/** **/ +/******************************************************************************/ + +module.exports = function (request) { + return github(request, owner, repo).then(function (all) { + return all; + }); +}; + +if (module === require.main) { + module.exports(require('@root/request')).then(function (all) { + all = require('../_webi/normalize.js')(all); + // just select the first 5 for demonstration + all.releases = all.releases.slice(0, 5); + console.info(JSON.stringify(all, null, 2)); + }); +}