Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kubectl-node-shell for openSUSE:Factory checked in at 2023-01-25 17:42:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kubectl-node-shell (Old) and /work/SRC/openSUSE:Factory/.kubectl-node-shell.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kubectl-node-shell" Wed Jan 25 17:42:58 2023 rev:2 rq:1060701 version:1.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kubectl-node-shell/kubectl-node-shell.changes 2023-01-14 00:03:56.873966082 +0100 +++ /work/SRC/openSUSE:Factory/.kubectl-node-shell.new.32243/kubectl-node-shell.changes 2023-01-25 17:49:15.554011178 +0100 @@ -1,0 +2,6 @@ +Tue Jan 24 08:43:38 UTC 2023 - [email protected] + +- Update to version 1.7.0: + * Add support for Windows nodes (#45) + +------------------------------------------------------------------- Old: ---- kubectl-node-shell-1.6.0.tar.gz New: ---- kubectl-node-shell-1.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kubectl-node-shell.spec ++++++ --- /var/tmp/diff_new_pack.3jymIT/_old 2023-01-25 17:49:15.962013358 +0100 +++ /var/tmp/diff_new_pack.3jymIT/_new 2023-01-25 17:49:15.966013379 +0100 @@ -22,7 +22,7 @@ %define executable_name kubectl-node_shell Name: kubectl-node-shell -Version: 1.6.0 +Version: 1.7.0 Release: 0 Summary: Exec into node via kubectl License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.3jymIT/_old 2023-01-25 17:49:16.006013593 +0100 +++ /var/tmp/diff_new_pack.3jymIT/_new 2023-01-25 17:49:16.010013614 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/kvaps/kubectl-node-shell</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v1.6.0</param> + <param name="revision">v1.7.0</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">v(.*)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.3jymIT/_old 2023-01-25 17:49:16.034013743 +0100 +++ /var/tmp/diff_new_pack.3jymIT/_new 2023-01-25 17:49:16.034013743 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/kvaps/kubectl-node-shell</param> - <param name="changesrevision">e4e79eefc56be52813e115bf9f17c896d65e6e22</param></service></servicedata> + <param name="changesrevision">4717bd2427d00d18d8c3f5a5177268c60d0d5cc0</param></service></servicedata> (No newline at EOF) ++++++ kubectl-node-shell-1.6.0.tar.gz -> kubectl-node-shell-1.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubectl-node-shell-1.6.0/README.md new/kubectl-node-shell-1.7.0/README.md --- old/kubectl-node-shell-1.6.0/README.md 2022-03-23 23:05:36.000000000 +0100 +++ new/kubectl-node-shell-1.7.0/README.md 2023-01-23 19:17:20.000000000 +0100 @@ -1,7 +1,7 @@ # kubectl node-shell *(formerly known as **kubectl-enter**)* -Start a root shell in the node's host OS running. +Start a root shell in the node's host OS running. Uses an alpine pod with nsenter for Linux nodes and a [HostProcess pod](https://kubernetes.io/docs/tasks/configure-pod-container/create-hostprocess-pod/) with PowerShell for Windows nodes.  diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kubectl-node-shell-1.6.0/kubectl-node_shell new/kubectl-node-shell-1.7.0/kubectl-node_shell --- old/kubectl-node-shell-1.6.0/kubectl-node_shell 2022-03-23 23:05:36.000000000 +0100 +++ new/kubectl-node-shell-1.7.0/kubectl-node_shell 2023-01-23 19:17:20.000000000 +0100 @@ -2,12 +2,15 @@ set -e kubectl=kubectl -version=1.5.5 +version=1.7.0 generator="" node="" nodefaultctx=0 nodefaultns=0 -cmd='[ "nsenter", "--target", "1", "--mount", "--uts", "--ipc", "--net", "--pid", "--"' +container_cpu="${KUBECTL_NODE_SHELL_POD_CPU:-100m}" +container_memory="${KUBECTL_NODE_SHELL_POD_MEMORY:-256Mi}" +labels="${KUBECTL_NODE_SHELL_LABELS}" + if [ -t 0 ]; then tty=true else @@ -68,11 +71,42 @@ esac done +if [ -z "$node" ]; then + echo "Please specify node name" + exit 1 +fi + # Set the default context and namespace to avoid situations where the user switch them during the build process [ "$nodefaultctx" = 1 ] || kubectl="$kubectl --context=$(${kubectl} config current-context)" [ "$nodefaultns" = 1 ] || kubectl="$kubectl --namespace=$(${kubectl} config view --minify --output 'jsonpath={.contexts..namespace}')" +# Check the node and retrieve the node OS label +os="$($kubectl get node $node -o jsonpath="{.metadata.labels.kubernetes\.io/os}" || exit 1)" + +# Set pod configuration per operating system +if [ "$os" = "windows" ]; then + image="${KUBECTL_NODE_SHELL_IMAGE_WINDOWS:-mcr.microsoft.com/powershell}" + name="pwsh" + pod="${name}-$(env LC_ALL=C tr -dc a-z0-9 </dev/urandom | head -c 6)" + # pwsh has to be launched via cmd.exe because of how containerd 1.6 handles the mount of the container filesystem + # see https://kubernetes.io/docs/tasks/configure-pod-container/create-hostprocess-pod/#volume-mounts + cmd_start='"cmd.exe", "/c", "%CONTAINER_SANDBOX_MOUNT_POINT%\\Program Files\\PowerShell\\latest\\pwsh.exe", "-nol", "-wd", "C:\\"' + cmd_arg_prefix=', "-Command"' + cmd_default='' + security_context='{"privileged":true,"windowsOptions":{"hostProcess":true,"runAsUserName":"NT AUTHORITY\\SYSTEM"}}' +else # If the OS isn't windows, assume linux + image="${KUBECTL_NODE_SHELL_IMAGE:-docker.io/library/alpine}" + name="nsenter" + pod="${name}-$(env LC_ALL=C tr -dc a-z0-9 </dev/urandom | head -c 6)" + cmd_start='"nsenter", "--target", "1", "--mount", "--uts", "--ipc", "--net", "--pid"' + cmd_arg_prefix=', "--"' + cmd_default=', "bash", "-l"' + security_context='{"privileged":true}' +fi + +# Build the container command if [ $# -gt 0 ]; then + cmd="[ $cmd_start $cmd_arg_prefix" while [ $# -gt 0 ]; do cmd="$cmd, \"$(echo "$1" | \ awk '{gsub(/["\\]/,"\\\\&");gsub(/\x1b/,"\\u001b");printf "%s",last;last=$0"\\n"} END{print $0}' \ @@ -81,26 +115,11 @@ done cmd="$cmd ]" else - cmd="$cmd, \"bash\", \"-l\" ]" -fi - -if [ -z "$node" ]; then - echo "Please specify node name" - exit 1 + cmd="[ $cmd_start $cmd_default ]" fi -image="${KUBECTL_NODE_SHELL_IMAGE:-docker.io/library/alpine}" -pod="nsenter-$(env LC_ALL=C tr -dc a-z0-9 </dev/urandom | head -c 6)" - -# Check the node -$kubectl get node "$node" >/dev/null || exit 1 - -container_cpu="${KUBECTL_NODE_SHELL_POD_CPU:-100m}" -container_memory="${KUBECTL_NODE_SHELL_POD_MEMORY:-256Mi}" -labels="${KUBECTL_NODE_SHELL_LABELS}" - overrides="$( - cat <<EOT +cat <<EOT { "spec": { "nodeName": "$node", @@ -108,36 +127,22 @@ "hostNetwork": true, "containers": [ { - "securityContext": { - "privileged": true - }, + "securityContext": $security_context, "image": "$image", - "name": "nsenter", + "name": "$name", "stdin": true, "stdinOnce": true, "tty": $tty, "command": $cmd, "resources": { - "limits": { - "cpu": "${container_cpu}", - "memory": "${container_memory}" - }, - "requests": { - "cpu": "${container_cpu}", - "memory": "${container_memory}" - } + "limits": { "cpu": "${container_cpu}", "memory": "${container_memory}" }, + "requests": { "cpu": "${container_cpu}", "memory": "${container_memory}" } } } ], "tolerations": [ - { - "key": "CriticalAddonsOnly", - "operator": "Exists" - }, - { - "effect": "NoExecute", - "operator": "Exists" - } + { "key": "CriticalAddonsOnly", "operator": "Exists" }, + { "effect": "NoExecute", "operator": "Exists" } ] } }
