Skip to content

Commit

Permalink
Alter the support message printed in k3sup
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Aug 26, 2022
1 parent 7a56f29 commit 386e158
Show file tree
Hide file tree
Showing 11 changed files with 74 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Expand Up @@ -10,6 +10,8 @@

## Are you a GitHub Sponsor (Yes/No?)

Due to limited resources, we can only respond to requests from sponsors

<!--- Check at https://github.com/sponsors/alexellis -->

- [ ] Yes
Expand Down
11 changes: 10 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Expand Up @@ -3,11 +3,20 @@
## Description
<!--- Describe your changes in detail -->

## Motivation and Context
## 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.

## Are you a GitHub Sponsor (Yes/No?)

Due to limited resources, we can only respond to requests from sponsors
<!--- Check at https://github.com/sponsors/alexellis -->

- [ ] Yes
- [ ] No

## How Has This Been Tested?
<!--- Please describe in detail how you tested your changes. -->
Expand Down
3 changes: 1 addition & 2 deletions LICENSE
@@ -1,7 +1,6 @@
MIT License

Copyright (c) 2019-2020 Alex Ellis
Copyright (c) 2020 k3sup author(s)
Copyright (c) 2019 Alex Ellis

Exclusions: assets, images and logos.

Expand Down
30 changes: 17 additions & 13 deletions cmd/install.go
Expand Up @@ -12,6 +12,7 @@ import (
"runtime"
"strings"

"github.com/alexellis/k3sup/pkg"
operator "github.com/alexellis/k3sup/pkg/operator"

homedir "github.com/mitchellh/go-homedir"
Expand Down Expand Up @@ -48,7 +49,8 @@ func MakeInstall() *cobra.Command {
Short: "Install k3s on a server via SSH",
Long: `Install k3s on a server via SSH.
` + SupportMsg,
` + pkg.SupportMessageShort + `
`,
Example: ` k3sup install --ip IP --user USER
k3sup install --local --k3s-version v1.19.7
Expand Down Expand Up @@ -100,10 +102,20 @@ Provide the --local-path flag with --merge if a kubeconfig already exists in som
if err != nil {
return err
}

_, err = command.Flags().GetIP("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
}

Expand Down Expand Up @@ -331,17 +343,6 @@ Provide the --local-path flag with --merge if a kubeconfig already exists in som
return nil
}

command.PreRunE = func(command *cobra.Command, args []string) error {
if _, err := command.Flags().GetIP("ip"); err != nil {
return err
}

if _, err := command.Flags().GetInt("ssh-port"); err != nil {
return err
}

return nil
}
return command
}

Expand Down Expand Up @@ -393,10 +394,13 @@ func writeConfig(path string, data []byte, context string, suppressMessage bool)
export KUBECONFIG=%s
kubectl config set-context %s
kubectl get node -o wide
%s
`,
absPath,
absPath,
context)
context,
pkg.SupportMessageShort)
}

if err := ioutil.WriteFile(absPath, []byte(data), 0600); err != nil {
Expand Down
15 changes: 7 additions & 8 deletions cmd/join.go
Expand Up @@ -6,27 +6,22 @@ import (
"runtime"
"strings"

"github.com/alexellis/k3sup/pkg"
operator "github.com/alexellis/k3sup/pkg/operator"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh"
)

// SupportMsg is aimed to inform the many hundreds of users of k3sup
// that they can do their part to support the project's development
// and maintenance.
const SupportMsg = `Give your support to k3sup via GitHub Sponsors:
https://github.com/sponsors/alexellis`

// MakeJoin creates the join command
func MakeJoin() *cobra.Command {
var command = &cobra.Command{
Use: "join",
Short: "Install the k3s agent on a remote host and join it to an existing server",
Long: `Install the k3s agent on a remote host and join it to an existing server
` + SupportMsg,
` + pkg.SupportMessageShort + `
`,
Example: ` k3sup join --user root --server-ip IP --ip IP
k3sup join --user pi \
Expand Down Expand Up @@ -223,6 +218,10 @@ func MakeJoin() *cobra.Command {
boostrapErr = setupAgent(serverHost, host, port, user, sshKeyPath, joinToken, k3sExtraArgs, k3sVersion, k3sChannel, printCommand)
}

if boostrapErr == nil {
fmt.Printf("\n%s\n", pkg.SupportMessageShort)
}

return boostrapErr
}

Expand Down
9 changes: 7 additions & 2 deletions cmd/update.go
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"

"github.com/alexellis/k3sup/pkg"
"github.com/spf13/cobra"
)

Expand All @@ -12,7 +13,8 @@ func MakeUpdate() *cobra.Command {
Short: "Print update instructions",
Long: `Print instructions for updating your version of k3sup.
` + SupportMsg,
` + pkg.SupportMessageShort + `
`,
Example: ` k3sup update`,
SilenceUsage: false,
}
Expand All @@ -24,6 +26,9 @@ func MakeUpdate() *cobra.Command {

const k3supUpdate = `You can update k3sup with the following:
# Use arkade, for a quick installation:
arkade get k3sup
# Remove cached versions of tools
rm -rf $HOME/.k3sup
Expand All @@ -35,4 +40,4 @@ curl -SLfs https://get.k3sup.dev | sh
# Or download from GitHub: https://github.com/alexellis/k3sup/releases
Thanks for using k3sup!`
` + pkg.SupportMessageShort
17 changes: 12 additions & 5 deletions cmd/version.go
Expand Up @@ -3,6 +3,7 @@ package cmd
import (
"fmt"

"github.com/alexellis/k3sup/pkg"
"github.com/morikuni/aec"
"github.com/spf13/cobra"
)
Expand All @@ -14,14 +15,20 @@ var (

func PrintK3supASCIIArt() {
k3supLogo := aec.RedF.Apply(k3supFigletStr)
support := aec.CyanF.Apply(pkg.SupportMessageShort)

fmt.Print(k3supLogo)

fmt.Printf("%s\n\n", support)
}

func MakeVersion() *cobra.Command {
var command = &cobra.Command{
Use: "version",
Short: "Print the version",
Example: ` k3sup version`,
Use: "version",
Short: "Print the version",
Example: ` k3sup version
` + pkg.SupportMessageShort + `
`,
SilenceUsage: false,
}
command.Run = func(cmd *cobra.Command, args []string) {
Expand All @@ -33,8 +40,6 @@ func MakeVersion() *cobra.Command {
}
fmt.Println("Git Commit:", GitCommit)

fmt.Printf("\n%s\n", SupportMsg)

}
return command
}
Expand All @@ -45,4 +50,6 @@ const k3supFigletStr = ` _ _____
| < ___) \__ \ |_| | |_) |
|_|\_\____/|___/\__,_| .__/
|_|
bootstrap K3s over SSH in < 60s 🚀
`
3 changes: 1 addition & 2 deletions get.sh
Expand Up @@ -177,8 +177,7 @@ getPackage() {
thanks() {
echo
echo "================================================================"
echo " Thanks for choosing k3sup."
echo " Support the project through GitHub Sponsors"
echo " alexellis's work on k3sup needs your support"
echo ""
echo " https://github.com/sponsors/alexellis"
echo "================================================================"
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Expand Up @@ -8,12 +8,12 @@ require (
github.com/morikuni/aec v1.0.0
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.5.0
golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8
golang.org/x/crypto v0.0.0-20220824171710-5757bc0c5503
)

require (
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 // indirect
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 // indirect
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
)
16 changes: 4 additions & 12 deletions go.sum
@@ -1,7 +1,6 @@
github.com/alexellis/go-execute v0.5.0 h1:L8kgNlFzNbJov7jrInlaig7i6ZUSz/tYYmqvb8dyD0s=
github.com/alexellis/go-execute v0.5.0/go.mod h1:AgHTcsCF9wrP0mMVTO8N+lFw1Biy71NybBOk8M+qgy8=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
Expand All @@ -16,17 +15,10 @@ github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8 h1:GIAS/yBem/gq2MUqgNIzUHW7cJMmx3TGZOrnyYaNQ6c=
golang.org/x/crypto v0.0.0-20220817201139-bc19a97f63c8/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664 h1:wEZYwx+kK+KlZ0hpvP2Ls1Xr4+RWnlzGFwPP0aiDjIU=
golang.org/x/sys v0.0.0-20220622161953-175b2fd9d664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6 h1:Sx/u41w+OwrInGdEckYmEuU5gHoGSL4QbDz3S9s6j4U=
golang.org/x/sys v0.0.0-20220818161305-2296e01440c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/crypto v0.0.0-20220824171710-5757bc0c5503 h1:vJ2V3lFLg+bBhgroYuRfyN583UzVveQmIXjc8T/y3to=
golang.org/x/crypto v0.0.0-20220824171710-5757bc0c5503/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64 h1:UiNENfZ8gDvpiWw7IpOMQ27spWmThO1RwwdQVbJahJM=
golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 h1:Q5284mrmYTpACcm+eAKjKJH48BBwSyfJqmmGDTtT8Vc=
golang.org/x/term v0.0.0-20220722155259-a9ba230a4035/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
12 changes: 11 additions & 1 deletion pkg/thanks.go
@@ -1,3 +1,13 @@
package pkg

const ThanksForUsing = `Thanks for using k3sup!`
// SupportMessageShort is an attempt to connect with the hundreds if not more
// of developers who use k3sup for free and do not support it in any way.
//
// Development comes at a real and personal cost, and is not funded by any
// company.
//
// If you're asking for my for time and support, you will need to be sponsor
// to get a response. I know that you wouldn't work for free.
//
// Alex
const SupportMessageShort = `🐳 k3sup needs your support: https://github.com/sponsors/alexellis`

0 comments on commit 386e158

Please sign in to comment.