From 386e15880961ffc869696142db682e2f211b3ed9 Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Fri, 26 Aug 2022 11:02:44 +0100 Subject: [PATCH] Alter the support message printed in k3sup Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- .github/ISSUE_TEMPLATE.md | 2 ++ .github/PULL_REQUEST_TEMPLATE.md | 11 ++++++++++- LICENSE | 3 +-- cmd/install.go | 30 +++++++++++++++++------------- cmd/join.go | 15 +++++++-------- cmd/update.go | 9 +++++++-- cmd/version.go | 17 ++++++++++++----- get.sh | 3 +-- go.mod | 4 ++-- go.sum | 16 ++++------------ pkg/thanks.go | 12 +++++++++++- 11 files changed, 74 insertions(+), 48 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 91a3e817..ada213b8 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -10,6 +10,8 @@ ## Are you a GitHub Sponsor (Yes/No?) +Due to limited resources, we can only respond to requests from sponsors + - [ ] Yes diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 9b7566b3..cf2a140a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,11 +3,20 @@ ## Description -## Motivation and Context +## Why do you need this? - [ ] 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 + + +- [ ] Yes +- [ ] No ## How Has This Been Tested? diff --git a/LICENSE b/LICENSE index b8cd0d9d..af98db7e 100644 --- a/LICENSE +++ b/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. diff --git a/cmd/install.go b/cmd/install.go index b3198d26..e5ea8fc1 100644 --- a/cmd/install.go +++ b/cmd/install.go @@ -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" @@ -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 @@ -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 } @@ -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 } @@ -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 { diff --git a/cmd/join.go b/cmd/join.go index 74c43552..f5b44b13 100644 --- a/cmd/join.go +++ b/cmd/join.go @@ -6,19 +6,13 @@ 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{ @@ -26,7 +20,8 @@ func MakeJoin() *cobra.Command { 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 \ @@ -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 } diff --git a/cmd/update.go b/cmd/update.go index a86226e1..68db3851 100644 --- a/cmd/update.go +++ b/cmd/update.go @@ -3,6 +3,7 @@ package cmd import ( "fmt" + "github.com/alexellis/k3sup/pkg" "github.com/spf13/cobra" ) @@ -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, } @@ -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 @@ -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 diff --git a/cmd/version.go b/cmd/version.go index 2cd0f993..e778cdea 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -3,6 +3,7 @@ package cmd import ( "fmt" + "github.com/alexellis/k3sup/pkg" "github.com/morikuni/aec" "github.com/spf13/cobra" ) @@ -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) { @@ -33,8 +40,6 @@ func MakeVersion() *cobra.Command { } fmt.Println("Git Commit:", GitCommit) - fmt.Printf("\n%s\n", SupportMsg) - } return command } @@ -45,4 +50,6 @@ const k3supFigletStr = ` _ _____ | < ___) \__ \ |_| | |_) | |_|\_\____/|___/\__,_| .__/ |_| + +bootstrap K3s over SSH in < 60s 🚀 ` diff --git a/get.sh b/get.sh index d7d3cabd..e7441cd3 100755 --- a/get.sh +++ b/get.sh @@ -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 "================================================================" diff --git a/go.mod b/go.mod index 2b72c801..0ddfe9ea 100644 --- a/go.mod +++ b/go.mod @@ -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 ) diff --git a/go.sum b/go.sum index 881100ad..8e756998 100644 --- a/go.sum +++ b/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= @@ -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= diff --git a/pkg/thanks.go b/pkg/thanks.go index c0bfef00..227b7339 100644 --- a/pkg/thanks.go +++ b/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`