Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package k3sup for openSUSE:Factory checked in at 2025-06-30 14:00:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/k3sup (Old) and /work/SRC/openSUSE:Factory/.k3sup.new.7067 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "k3sup" Mon Jun 30 14:00:53 2025 rev:13 rq:1289140 version:0.13.10 Changes: -------- --- /work/SRC/openSUSE:Factory/k3sup/k3sup.changes 2025-05-22 16:56:47.625718708 +0200 +++ /work/SRC/openSUSE:Factory/.k3sup.new.7067/k3sup.changes 2025-06-30 14:01:22.250897651 +0200 @@ -1,0 +2,19 @@ +Mon Jun 30 05:16:39 UTC 2025 - Johannes Kastl <[email protected]> + +- Update to version 0.13.10: + * Merge a config from k3sup plan into a local file i.e. + $HOME/.kube/config + k3sup plan --merge + * Fetch a config from a pre-existing installation - either + because you lost the original, are on another machine, or want + to merge it into your main KUBECONFIG instead of having a + separate file + k3sup get-config + See the README.md for complete examples + * Commits + - 5d97659 Fix Makefile for Linux target when run on an Arm64 + Mac by @alexellis + - e515ca4 Add get-config command by @alexellis + - 8602af8 Add --merge flag to k3sup plan by @alexellis + +------------------------------------------------------------------- Old: ---- k3sup-0.13.9.obscpio New: ---- k3sup-0.13.10.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ k3sup.spec ++++++ --- /var/tmp/diff_new_pack.YlWuBO/_old 2025-06-30 14:01:24.146976407 +0200 +++ /var/tmp/diff_new_pack.YlWuBO/_new 2025-06-30 14:01:24.150976572 +0200 @@ -17,7 +17,7 @@ Name: k3sup -Version: 0.13.9 +Version: 0.13.10 Release: 0 Summary: Bootstrap Kubernetes with k3s over SSH < 1 min License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.YlWuBO/_old 2025-06-30 14:01:24.178977735 +0200 +++ /var/tmp/diff_new_pack.YlWuBO/_new 2025-06-30 14:01:24.182977902 +0200 @@ -3,7 +3,7 @@ <param name="url">https://github.com/alexellis/k3sup</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">0.13.9</param> + <param name="revision">0.13.10</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">enable</param> <param name="versionrewrite-pattern">(.*)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.YlWuBO/_old 2025-06-30 14:01:24.210979065 +0200 +++ /var/tmp/diff_new_pack.YlWuBO/_new 2025-06-30 14:01:24.214979231 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/alexellis/k3sup</param> - <param name="changesrevision">a1700f64dcffd249890b13cf6d97f4c120a53e08</param></service></servicedata> + <param name="changesrevision">5d97659e0d8bac3c3c497d4ff1d5d04a0c341b8b</param></service></servicedata> (No newline at EOF) ++++++ k3sup-0.13.9.obscpio -> k3sup-0.13.10.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/.github/CODEOWNERS new/k3sup-0.13.10/.github/CODEOWNERS --- old/k3sup-0.13.9/.github/CODEOWNERS 1970-01-01 01:00:00.000000000 +0100 +++ new/k3sup-0.13.10/.github/CODEOWNERS 2025-06-26 12:15:33.000000000 +0200 @@ -0,0 +1 @@ +@alexellis \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/.github/FUNDING.yml new/k3sup-0.13.10/.github/FUNDING.yml --- old/k3sup-0.13.9/.github/FUNDING.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/k3sup-0.13.10/.github/FUNDING.yml 2025-06-26 12:15:33.000000000 +0200 @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: alexellis diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/.github/ISSUE_TEMPLATE/report-an-issue.md new/k3sup-0.13.10/.github/ISSUE_TEMPLATE/report-an-issue.md --- old/k3sup-0.13.9/.github/ISSUE_TEMPLATE/report-an-issue.md 1970-01-01 01:00:00.000000000 +0100 +++ new/k3sup-0.13.10/.github/ISSUE_TEMPLATE/report-an-issue.md 2025-06-26 12:15:33.000000000 +0200 @@ -0,0 +1,33 @@ +--- +name: Report an issue +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Expected behaviour** + +What did you expect to happen? + +**Current behaviour** + +What happened? + +**To Reproduce** + +Include full unabridged instructions that anyone can use to reproduce the problem + + +**Screenshots / console output** + +Add a screenshot or console output + +**Versions:** + - OS: + - K3sup Version: + +**Additional context** + +Add any other context about the problem here. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/.github/ISSUE_TEMPLATE/request-a-feature.md new/k3sup-0.13.10/.github/ISSUE_TEMPLATE/request-a-feature.md --- old/k3sup-0.13.9/.github/ISSUE_TEMPLATE/request-a-feature.md 1970-01-01 01:00:00.000000000 +0100 +++ new/k3sup-0.13.10/.github/ISSUE_TEMPLATE/request-a-feature.md 2025-06-26 12:15:33.000000000 +0200 @@ -0,0 +1,24 @@ +--- +name: Request a feature +about: Request a new feature or change in this project +title: '' +labels: '' +assignees: '' + +--- + +**What do you want?** + +Focus on the feature, not the technical approach or solution. + +**Why do you want this?** + +Make a case for why your request should be considered. For instance, are you a GitHub Sponsor? + +**Recommended solution** + +If you are aware of one, share your preferred solution here + +**Additional context** + +Share any other context you feel is relevant or adds to your case. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/.github/ISSUE_TEMPLATE.md new/k3sup-0.13.10/.github/ISSUE_TEMPLATE.md --- old/k3sup-0.13.9/.github/ISSUE_TEMPLATE.md 1970-01-01 01:00:00.000000000 +0100 +++ new/k3sup-0.13.10/.github/ISSUE_TEMPLATE.md 2025-06-26 12:15:33.000000000 +0200 @@ -0,0 +1,59 @@ +<!--- Provide a general summary of the issue in the Title above --> + +## Why do you need this? + +<!--- How has this issue affected you? What are you trying to accomplish? --> +<!--- Providing context helps us come up with a solution that is most useful in the real world --> +<!--- Is this request for work, a client, your employer or for fun? --> + +## Expected Behaviour +<!--- If you're describing a bug, tell us what should happen --> +<!--- If you're suggesting a change/improvement, tell us how it should work --> + +## Current Behaviour +<!--- If describing a bug, tell us what happens instead of the expected behavior --> +<!--- If suggesting a change/improvement, explain the difference from current behavior --> + +## Possible Solution +<!--- Not obligatory, but suggest a fix/reason for the bug, --> +<!--- or ideas how to implement the addition or change --> + + +## Steps to Reproduce +<!--- Provide a link to a live example, or an unambiguous set of steps to --> +<!--- reproduce this bug. Include code to reproduce, if relevant --> +1. +2. +3. +4. + +## Your Environment + +* k3sup version: + +``` +k3sup version +``` + +* What Kubernetes distribution, client and server version are you using? + +``` +kubectl version +``` + +* What OS or type or VM are you using for your cluster? Where is it hosted? (for `k3sup install/join`): + +* Operating System and version (e.g. Linux, Windows, MacOS): + +``` +uname -a + +cat /etc/os-release +``` + +## Do you want to work on this? + +Subject to design approval, are you willing to work on a Pull Request for this issue or feature request? + +- [ ] Yes +- [ ] No diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/.github/PULL_REQUEST_TEMPLATE.md new/k3sup-0.13.10/.github/PULL_REQUEST_TEMPLATE.md --- old/k3sup-0.13.9/.github/PULL_REQUEST_TEMPLATE.md 1970-01-01 01:00:00.000000000 +0100 +++ new/k3sup-0.13.10/.github/PULL_REQUEST_TEMPLATE.md 2025-06-26 12:15:33.000000000 +0200 @@ -0,0 +1,33 @@ +<!--- Provide a general summary of the issue in the Title above --> + +## Why do you need this? +<!--- Why is this change required? What problem does it solve? --> +<!--- If it fixes an open issue, please link to the issue here. --> +- [ ] I have raised an issue to propose this change ([required](https://github.com/openfaas/faas/blob/master/CONTRIBUTING.md)) + +If you have no approval from a maintainer, close this PR and raise an issue. + +## Description +<!--- Describe your changes in detail --> + +## How Has This Been Tested? +<!--- Please describe in detail how you tested your changes. --> +<!--- Include details of your testing environment, and the tests you ran to --> +<!--- see how your change affects other areas of the code, etc. --> + +## Types of changes +<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to change) + +## Checklist: +<!--- Go over all the following points, and put an `x` in all the boxes that apply. --> +<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. +- [ ] I've read the [CONTRIBUTION](https://github.com/alexellis/arkade/blob/master/CONTRIBUTING.md) guide +- [ ] I have signed-off my commits with `git commit -s` +- [ ] I have added tests to cover my changes. +- [ ] All new and existing tests passed. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/.github/workflows/build.yaml new/k3sup-0.13.10/.github/workflows/build.yaml --- old/k3sup-0.13.9/.github/workflows/build.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/k3sup-0.13.10/.github/workflows/build.yaml 2025-06-26 12:15:33.000000000 +0200 @@ -0,0 +1,27 @@ +name: build + +on: + push: + branches: + - '*' + pull_request: + branches: + - '*' + +jobs: + build: + concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + with: + fetch-depth: 1 + - name: Install Go + uses: actions/setup-go@master + with: + go-version: "1.23.x" + - name: Make all + run: make all diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/.github/workflows/publish.yaml new/k3sup-0.13.10/.github/workflows/publish.yaml --- old/k3sup-0.13.9/.github/workflows/publish.yaml 1970-01-01 01:00:00.000000000 +0100 +++ new/k3sup-0.13.10/.github/workflows/publish.yaml 2025-06-26 12:15:33.000000000 +0200 @@ -0,0 +1,26 @@ +name: publish + +on: + push: + tags: + - '*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + with: + fetch-depth: 1 + - name: Install Go + uses: actions/setup-go@master + with: + go-version: "1.23.x" + - name: Make all + run: make all + - name: Upload release binaries + uses: alexellis/[email protected] + env: + GITHUB_TOKEN: ${{ github.token }} + with: + asset_paths: '["./bin/k3sup*"]' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/.gitignore new/k3sup-0.13.10/.gitignore --- old/k3sup-0.13.9/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/k3sup-0.13.10/.gitignore 2025-06-26 12:15:33.000000000 +0200 @@ -0,0 +1,10 @@ +k3sup +bin/** +kubeconfig +.DS_Store +.idea/ +mc +/install.sh +/*.json +*.txt +/bootstrap.sh diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/Makefile new/k3sup-0.13.10/Makefile --- old/k3sup-0.13.9/Makefile 2025-05-21 10:50:06.000000000 +0200 +++ new/k3sup-0.13.10/Makefile 2025-06-26 12:15:33.000000000 +0200 @@ -20,7 +20,7 @@ dist: mkdir -p bin/ rm -rf bin/k3sup* - CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -o bin/k3sup + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags $(LDFLAGS) -o bin/k3sup GOARM=7 GOARCH=arm CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -o bin/k3sup-armhf GOARCH=arm64 CGO_ENABLED=0 GOOS=linux go build -ldflags $(LDFLAGS) -o bin/k3sup-arm64 CGO_ENABLED=0 GOOS=darwin go build -ldflags $(LDFLAGS) -o bin/k3sup-darwin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/README.md new/k3sup-0.13.10/README.md --- old/k3sup-0.13.9/README.md 2025-05-21 10:50:06.000000000 +0200 +++ new/k3sup-0.13.10/README.md 2025-06-26 12:15:33.000000000 +0200 @@ -28,6 +28,7 @@ - [👑 Setup a Kubernetes *server* with `k3sup`](#-setup-a-kubernetes-server-with-k3sup) - [Checking if a cluster is ready](#checking-if-a-cluster-is-ready) - [Merging clusters into your KUBECONFIG](#merging-clusters-into-your-kubeconfig) + - [Getting a kubeconfig from an existing installation](#getting-a-kubeconfig-from-an-existing-installation) - [😸 Join some agents to your Kubernetes server](#-join-some-agents-to-your-kubernetes-server) - [Use your hardware authentication / 2FA or SSH Agent](#use-your-hardware-authentication--2fa-or-ssh-agent) - [K3sup plan for automation](#k3sup-plan-for-automation) @@ -240,6 +241,48 @@ Here we set a context of `my-k3s` and also merge into our main local `KUBECONFIG` file, so we could run `kubectl config use-context my-k3s` or `kubectx my-k3s`. +### Getting a kubeconfig from an existing installation + +The `k3sup get-config` command allows you to retrieve kubeconfig files from existing K3s installations without performing any installation steps. This is useful when you already have K3s running and just need to access the cluster configuration. + +You can also use it if you initially created a local `./kubeconfig` file but now want to merge it under a meaningful context name to your main `$HOME/.kube/config` file. + +Get kubeconfig from a remote server: + +```bash +k3sup get-config \ + --host 192.168.0.100 \ + --user ubuntu \ + --local-path ./kubeconfig +``` + +Get kubeconfig from a local installation: + +```bash +k3sup get-config --local +``` + +Merge kubeconfig into your main KUBECONFIG file: + +```bash +k3sup get-config \ + --host 192.168.0.100 \ + --user ubuntu \ + --merge \ + --local-path $HOME/.kube/config \ + --context my-remote-cluster +``` + +Use a custom SSH key: + +```bash +k3sup get-config \ + --host 192.168.0.100 \ + --user ubuntu \ + --ssh-key $HOME/.ssh/my-key \ + --local-path ./kubeconfig +``` + ### 😸 Join some agents to your Kubernetes server Let's say that you have a server, and have already run the following: @@ -714,7 +757,7 @@ * [Creating a k3s Cluster with k3sup & Multipass 💻☸️](https://dev.to/tomowatt/creating-a-k3s-cluster-with-k3sup-multipass-h26) by Tom Watt -* [How I’ve set up my highly-available Kubernetes cluster](https://jmac.ph/2021/01/25/how-ive-set-up-my-highly-available-kubernetes-cluster/) by JJ Macalinao +* [How I've set up my highly-available Kubernetes cluster](https://jmac.ph/2021/01/25/how-ive-set-up-my-highly-available-kubernetes-cluster/) by JJ Macalinao * [Creating a K3S Raspberry PI Cluster with K3Sup to fire up nightscout with MongoDB](https://h3rmanns.medium.com/creating-a-k3s-raspberry-pi-cluster-with-k3sup-to-fire-up-a-nightscout-backend-service-based-on-a-27c1f5727e5b) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/cmd/get-config.go new/k3sup-0.13.10/cmd/get-config.go --- old/k3sup-0.13.9/cmd/get-config.go 1970-01-01 01:00:00.000000000 +0100 +++ new/k3sup-0.13.10/cmd/get-config.go 2025-06-26 12:15:33.000000000 +0200 @@ -0,0 +1,162 @@ +package cmd + +import ( + "fmt" + "log" + "net" + + "github.com/alexellis/k3sup/pkg" + operator "github.com/alexellis/k3sup/pkg/operator" + + "github.com/spf13/cobra" +) + +// MakeGetConfig creates the get-config command +func MakeGetConfig() *cobra.Command { + var command = &cobra.Command{ + Use: "get-config", + Short: "Get kubeconfig from an existing K3s installation", + Long: `Create a local kubeconfig for use with kubectl from your local machine. + +` + pkg.SupportMessageShort + ` +`, + Example: ` # Get the kubeconfig and save it to ./kubeconfig in the local + # directory under the default context + k3sup get-config --host HOST \ + --local-path ./kubeconfig + + # Merge kubeconfig into local file under custom context + k3sup get-config \ + --host HOST \ + --merge \ + --local-path $HOME/.kube/kubeconfig \ + --context k3s-prod-eu-1 + + # Get kubeconfig from local installation directly on a server + # where you ran "k3sup install --local" + k3sup get-config --local`, + SilenceUsage: true, + } + + command.Flags().IP("ip", net.ParseIP("127.0.0.1"), "Public IP of node") + command.Flags().String("user", "root", "Username for SSH login") + command.Flags().String("host", "", "Public hostname of node") + command.Flags().String("ssh-key", "~/.ssh/id_rsa", "The ssh key to use for remote login") + command.Flags().Int("ssh-port", 22, "The port on which to connect for ssh") + command.Flags().Bool("sudo", true, "Use sudo for kubeconfig retrieval. e.g. set to false when using the root user and no sudo is available.") + command.Flags().String("local-path", "kubeconfig", "Local path to save the kubeconfig file") + command.Flags().String("context", "default", "Set the name of the kubeconfig context.") + command.Flags().Bool("merge", false, `Merge the config with existing kubeconfig if it already exists. +Provide the --local-path flag with --merge if a kubeconfig already exists in some other directory`) + command.Flags().Bool("print-command", false, "Print a command that you can use with SSH to manually recover from an error") + command.Flags().Bool("local", false, "Perform a local get-config without using ssh") + + command.PreRunE = func(command *cobra.Command, args []string) error { + local, err := command.Flags().GetBool("local") + if err != nil { + return err + } + + if !local { + _, err = command.Flags().GetString("host") + if err != nil { + return err + } + + if _, err := command.Flags().GetIP("ip"); err != nil { + return err + } + + if _, err := command.Flags().GetInt("ssh-port"); err != nil { + return err + } + } + return nil + } + + command.RunE = func(command *cobra.Command, args []string) error { + localKubeconfig, _ := command.Flags().GetString("local-path") + useSudo, err := command.Flags().GetBool("sudo") + if err != nil { + return err + } + + sudoPrefix := "" + if useSudo { + sudoPrefix = "sudo " + } + + local, _ := command.Flags().GetBool("local") + + ip, err := command.Flags().GetIP("ip") + if err != nil { + return err + } + + host, err := command.Flags().GetString("host") + if err != nil { + return err + } + if len(host) == 0 { + host = ip.String() + } + + log.Println(host) + + printCommand, err := command.Flags().GetBool("print-command") + if err != nil { + return err + } + + merge, err := command.Flags().GetBool("merge") + if err != nil { + return err + } + context, err := command.Flags().GetString("context") + if err != nil { + return err + } + + getConfigcommand := fmt.Sprintf(sudoPrefix + "cat /etc/rancher/k3s/k3s.yaml\n") + + if local { + operator := operator.ExecOperator{} + + if err = obtainKubeconfig(operator, getConfigcommand, host, context, localKubeconfig, merge); err != nil { + return err + } + + return nil + } + + fmt.Println("Public IP: " + host) + + port, _ := command.Flags().GetInt("ssh-port") + user, _ := command.Flags().GetString("user") + sshKey, _ := command.Flags().GetString("ssh-key") + + sshKeyPath := expandPath(sshKey) + address := fmt.Sprintf("%s:%d", host, port) + + sshOperator, sshOperatorDone, errored, err := connectOperator(user, address, sshKeyPath) + if errored { + return err + } + + if sshOperatorDone != nil { + defer sshOperatorDone() + } + + if printCommand { + fmt.Printf("ssh: %s\n", getConfigcommand) + } + + if err = obtainKubeconfig(sshOperator, getConfigcommand, host, context, localKubeconfig, merge); err != nil { + return err + } + + return nil + } + + return command +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/cmd/install.go new/k3sup-0.13.10/cmd/install.go --- old/k3sup-0.13.9/cmd/install.go 2025-05-21 10:50:06.000000000 +0200 +++ new/k3sup-0.13.10/cmd/install.go 2025-06-26 12:15:33.000000000 +0200 @@ -94,7 +94,6 @@ command.Flags().Int("ssh-port", 22, "The port on which to connect for ssh") command.Flags().Bool("sudo", true, "Use sudo for installation. e.g. set to false when using the root user and no sudo is available.") command.Flags().Bool("skip-install", false, "Skip the k3s installer") - command.Flags().Bool("print-config", false, "Print the kubeconfig obtained from the server after installation") command.Flags().String("local-path", "kubeconfig", "Local path to save the kubeconfig file") command.Flags().String("context", "default", "Set the name of the kubeconfig context.") @@ -158,11 +157,6 @@ return err } - printConfig, err := command.Flags().GetBool("print-config") - if err != nil { - return err - } - sudoPrefix := "" if useSudo { sudoPrefix = "sudo " @@ -280,7 +274,7 @@ fmt.Printf("Skipping local installation\n") } - if err = obtainKubeconfig(operator, getConfigcommand, host, context, localKubeconfig, merge, printConfig); err != nil { + if err = obtainKubeconfig(operator, getConfigcommand, host, context, localKubeconfig, merge); err != nil { return err } @@ -325,7 +319,7 @@ fmt.Printf("ssh: %s\n", getConfigcommand) } - if err = obtainKubeconfig(sshOperator, getConfigcommand, host, context, localKubeconfig, merge, printConfig); err != nil { + if err = obtainKubeconfig(sshOperator, getConfigcommand, host, context, localKubeconfig, merge); err != nil { return err } @@ -408,16 +402,12 @@ return ssh.PublicKeysCallback(agent.NewClient(sshAgent).Signers), nil } -func obtainKubeconfig(operator operator.CommandOperator, getConfigcommand, host, context, localKubeconfig string, merge, printConfig bool) error { +func obtainKubeconfig(operator operator.CommandOperator, getConfigcommand, host, context, localKubeconfig string, merge bool) error { res, err := operator.ExecuteStdio(getConfigcommand, false) if err != nil { return fmt.Errorf("error received processing command: %s", err) } - if printConfig { - fmt.Printf("Result: %s %s\n", string(res.StdOut), string(res.StdErr)) - } - absPath, _ := filepath.Abs(expandPath(localKubeconfig)) kubeconfig := rewriteKubeconfig(string(res.StdOut), host, context) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/cmd/plan.go new/k3sup-0.13.10/cmd/plan.go --- old/k3sup-0.13.9/cmd/plan.go 2025-05-21 10:50:06.000000000 +0200 +++ new/k3sup-0.13.10/cmd/plan.go 2025-06-26 12:15:33.000000000 +0200 @@ -50,6 +50,9 @@ command.Flags().Int("limit", 0, "Maximum number of nodes to use from the devices file, 0 to use all devices") + command.Flags().Bool("merge", true, `Merge the config with existing kubeconfig if it already exists. +Provide the --local-path flag with --merge if a kubeconfig already exists in some other directory`) + command.RunE = func(cmd *cobra.Command, args []string) error { if len(args) == 0 { @@ -64,6 +67,7 @@ } background, _ := cmd.Flags().GetBool("background") + merge, _ := cmd.Flags().GetBool("merge") var hosts []Host if err = json.Unmarshal(data, &hosts); err != nil { @@ -93,6 +97,13 @@ --ssh-key %s`, sshKey) } + mergeStr := "" + if merge { + if _, err := os.Stat(kubeconfig); err == nil { + mergeStr = " \n--merge" + } + } + bgStr := "" if background { bgStr = " &" @@ -123,7 +134,7 @@ --user %s \ --cluster \ --local-path %s \ ---context %s%s%s%s +--context %s%s%s%s%s `, host.IP, user, @@ -131,7 +142,8 @@ contextName, tlsSanStr, serverExtraArgsSt, - sshKeySt) + sshKeySt, + mergeStr) script += fmt.Sprintf(` echo "Fetching the server's node-token into memory" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/k3sup-0.13.9/main.go new/k3sup-0.13.10/main.go --- old/k3sup-0.13.9/main.go 2025-05-21 10:50:06.000000000 +0200 +++ new/k3sup-0.13.10/main.go 2025-06-26 12:15:33.000000000 +0200 @@ -17,6 +17,7 @@ cmdReady := cmd.MakeReady() cmdPlan := cmd.MakePlan() cmdNodeToken := cmd.MakeNodeToken() + cmdGetConfig := cmd.MakeGetConfig() printk3supASCIIArt := cmd.PrintK3supASCIIArt @@ -58,6 +59,7 @@ rootCmd.AddCommand(cmdReady) rootCmd.AddCommand(cmdPlan) rootCmd.AddCommand(cmdNodeToken) + rootCmd.AddCommand(cmdGetConfig) if err := rootCmd.Execute(); err != nil { os.Exit(1) ++++++ k3sup.obsinfo ++++++ --- /var/tmp/diff_new_pack.YlWuBO/_old 2025-06-30 14:01:24.690999003 +0200 +++ /var/tmp/diff_new_pack.YlWuBO/_new 2025-06-30 14:01:24.694999169 +0200 @@ -1,5 +1,5 @@ name: k3sup -version: 0.13.9 -mtime: 1747817406 -commit: a1700f64dcffd249890b13cf6d97f4c120a53e08 +version: 0.13.10 +mtime: 1750932933 +commit: 5d97659e0d8bac3c3c497d4ff1d5d04a0c341b8b ++++++ vendor.tar.gz ++++++
