Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --merge flag to plan command #440

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

DaruZero
Copy link

Why do you need this?

This PR adds the --merge flag to the plan command, in order to add said flag to the generated script. This way, when executing the script, it is possible to merge the new kubeconfig with an existing one, making it easier to fully automate the creation of clusters in CI/CD pipelines without manual intervention

If you have no approval from a maintainer, close this PR and raise an issue.

Description

Added the flag to the command, with a check that conditionally adds the --merge flag to the install command of the primary server. Indentation and blank lines remain the same as before.

How Has This Been Tested?

Compiled the program and run it with and without the new flag. Here's the outputs:

  • ./bin/k3sup plan hosts.json --local-path ./kubeconfig:

    #!/bin/sh
    
    echo "Setting up primary server 1"
    k3sup install --host test-host-01 \
    --user root \
    --cluster \
    --local-path ./kubeconfig \
    --context default
    
    echo "Fetching the server's node-token into memory"
    
    export NODE_TOKEN=$(k3sup node-token --host test-host-01 --user root)
    
    ...
  • ./bin/k3sup plan hosts.json --local-path ./kubeconfig --merge:

    #!/bin/sh
    
    echo "Setting up primary server 1"
    k3sup install --host test-host-01 \
    --user root \
    --cluster \
    --local-path ./kubeconfig \
    --context default \
    --merge
    
    echo "Fetching the server's node-token into memory"
    
    export NODE_TOKEN=$(k3sup node-token --host test-host-01 --user root)
    
    ...

I haven't added unit tests, as there are none for the plan command.

Types of changes

  • 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:

  • 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 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.

Signed-off-by: Matteo Danelon <[email protected]>
@DaruZero DaruZero force-pushed the feat/438/add-merge-flag-to-plan-cmd branch from badd2e0 to 72987eb Compare August 20, 2024 09:26
@DaruZero
Copy link
Author

DaruZero commented Sep 5, 2024

Hi @alexellis, any chance you can take a look at this?

@alexellis
Copy link
Owner

Hi @DaruZero of course there is a chance 🙂

As I've mentioned in the past, k3sup needs sponsors - and I'll accelerate support and features for those who sponsor my work.

For now since most folks don't want to do that, let me say I've seem the PR and the contribution is appreciated. I'll get to it when I can.

Regards,

Alex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add --merge flag to k3sup plan command
2 participants