Change airshipadm to airshipctl
This commit is contained in:
parent
2880bea640
commit
7a34fd98d9
@ -1,7 +1,7 @@
|
||||
FROM golang:1.12
|
||||
|
||||
COPY . /go/airshipadm
|
||||
COPY . /go/airshipctl
|
||||
|
||||
WORKDIR /go/airshipadm
|
||||
WORKDIR /go/airshipctl
|
||||
|
||||
CMD go install && airshipadm version
|
||||
CMD go install && airshipctl version
|
||||
|
4
Makefile
4
Makefile
@ -1,7 +1,7 @@
|
||||
SHELL := /bin/bash
|
||||
|
||||
BINDIR := bin
|
||||
EXECUTABLE_CLI := airshipadm
|
||||
EXECUTABLE_CLI := airshipctl
|
||||
|
||||
SCRIPTS_DIR := scripts
|
||||
|
||||
@ -58,6 +58,6 @@ docs:
|
||||
|
||||
.PHONY: update-golden
|
||||
update-golden: TESTFLAGS += -update -v
|
||||
update-golden: PKG = github.com/ian-howell/airshipadm/cmd
|
||||
update-golden: PKG = github.com/ian-howell/airshipctl/cmd
|
||||
update-golden:
|
||||
@go test $(PKG) $(TESTFLAGS)
|
||||
|
16
cmd/root.go
16
cmd/root.go
@ -6,20 +6,20 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"github.com/ian-howell/airshipadm/pkg/environment"
|
||||
"github.com/ian-howell/airshipadm/pkg/kube"
|
||||
"github.com/ian-howell/airshipadm/pkg/log"
|
||||
"github.com/ian-howell/airshipctl/pkg/environment"
|
||||
"github.com/ian-howell/airshipctl/pkg/kube"
|
||||
"github.com/ian-howell/airshipctl/pkg/log"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var settings environment.AirshipADMSettings
|
||||
var settings environment.AirshipCTLSettings
|
||||
|
||||
// NewRootCmd creates the root `airshipadm` command. All other commands are
|
||||
// NewRootCmd creates the root `airshipctl` command. All other commands are
|
||||
// subcommands branching from this one
|
||||
func NewRootCmd(out io.Writer, client *kube.Client, args []string) (*cobra.Command, error) {
|
||||
rootCmd := &cobra.Command{
|
||||
Use: "airshipadm",
|
||||
Short: "airshipadm is a unified entrypoint to various airship components",
|
||||
Use: "airshipctl",
|
||||
Short: "airshipctl is a unified entrypoint to various airship components",
|
||||
}
|
||||
rootCmd.SetOutput(out)
|
||||
|
||||
@ -39,7 +39,7 @@ func NewRootCmd(out io.Writer, client *kube.Client, args []string) (*cobra.Comma
|
||||
return rootCmd, nil
|
||||
}
|
||||
|
||||
// Execute runs the base airshipadm command
|
||||
// Execute runs the base airshipctl command
|
||||
func Execute(out io.Writer) {
|
||||
client, err := kube.NewForConfig(settings.KubeConfigFilePath)
|
||||
osExitIfError(out, err)
|
||||
|
@ -3,7 +3,7 @@ package cmd_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ian-howell/airshipadm/internal/test"
|
||||
"github.com/ian-howell/airshipctl/internal/test"
|
||||
)
|
||||
|
||||
func TestRoot(t *testing.T) {
|
||||
|
12
cmd/testdata/TestRootGoldenOutput/default.golden
vendored
12
cmd/testdata/TestRootGoldenOutput/default.golden
vendored
@ -1,18 +1,18 @@
|
||||
airshipadm is a unified entrypoint to various airship components
|
||||
airshipctl is a unified entrypoint to various airship components
|
||||
|
||||
Usage:
|
||||
airshipadm [command]
|
||||
airshipctl [command]
|
||||
|
||||
Available Commands:
|
||||
help Help about any command
|
||||
version Show the version number of airshipadm and its underlying tools
|
||||
version Show the version number of airshipctl and its underlying tools
|
||||
|
||||
Flags:
|
||||
--debug enable verbose output
|
||||
-h, --help help for airshipadm
|
||||
-h, --help help for airshipctl
|
||||
--kubeconfig string path to kubeconfig
|
||||
|
||||
Additional help topics:
|
||||
airshipadm workflow access to workflows
|
||||
airshipctl workflow access to workflows
|
||||
|
||||
Use "airshipadm [command] --help" for more information about a command.
|
||||
Use "airshipctl [command] --help" for more information about a command.
|
||||
|
@ -7,20 +7,20 @@ import (
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
kube "github.com/ian-howell/airshipadm/pkg/kube"
|
||||
kube "github.com/ian-howell/airshipctl/pkg/kube"
|
||||
)
|
||||
|
||||
const versionLong = `Show the versions for the airshipadm tool and its components.
|
||||
const versionLong = `Show the versions for the airshipctl tool and its components.
|
||||
This includes the following components, in order:
|
||||
* airshipadm client
|
||||
* airshipctl client
|
||||
* kubernetes cluster
|
||||
`
|
||||
|
||||
// NewVersionCommand prints out the versions of airshipadm and its underlying tools
|
||||
// NewVersionCommand prints out the versions of airshipctl and its underlying tools
|
||||
func NewVersionCommand(out io.Writer, client *kube.Client) *cobra.Command {
|
||||
versionCmd := &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Show the version number of airshipadm and its underlying tools",
|
||||
Short: "Show the version number of airshipctl and its underlying tools",
|
||||
Long: versionLong,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
clientV := clientVersion()
|
||||
|
@ -3,7 +3,7 @@ package cmd_test
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/ian-howell/airshipadm/internal/test"
|
||||
"github.com/ian-howell/airshipctl/internal/test"
|
||||
)
|
||||
|
||||
func TestVersion(t *testing.T) {
|
||||
|
2
go.mod
2
go.mod
@ -1,4 +1,4 @@
|
||||
module github.com/ian-howell/airshipadm
|
||||
module github.com/ian-howell/airshipctl
|
||||
|
||||
go 1.12
|
||||
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ian-howell/airshipadm/cmd"
|
||||
"github.com/ian-howell/airshipadm/pkg/kube"
|
||||
"github.com/ian-howell/airshipctl/cmd"
|
||||
"github.com/ian-howell/airshipctl/pkg/kube"
|
||||
"k8s.io/client-go/kubernetes/fake"
|
||||
)
|
||||
|
||||
|
2
main.go
2
main.go
@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/ian-howell/airshipadm/cmd"
|
||||
"github.com/ian-howell/airshipctl/cmd"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -1,9 +1,9 @@
|
||||
package environment
|
||||
|
||||
// AirshipADMSettings is a container for all of the settings needed by airshipadm
|
||||
type AirshipADMSettings struct {
|
||||
// AirshipCTLSettings is a container for all of the settings needed by airshipctl
|
||||
type AirshipCTLSettings struct {
|
||||
// KubeConfigFilePath is the path to the kubernetes configuration file.
|
||||
// This flag is only needed when airshipadm is being used
|
||||
// This flag is only needed when airshipctl is being used
|
||||
// out-of-cluster
|
||||
KubeConfigFilePath string
|
||||
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/tools/clientcmd"
|
||||
|
||||
"github.com/ian-howell/airshipadm/pkg/util"
|
||||
"github.com/ian-howell/airshipctl/pkg/util"
|
||||
)
|
||||
|
||||
// Client is a device which communicates with the Kubernetes API
|
||||
|
@ -4,13 +4,13 @@ import (
|
||||
"io"
|
||||
"log"
|
||||
|
||||
"github.com/ian-howell/airshipadm/pkg/environment"
|
||||
"github.com/ian-howell/airshipctl/pkg/environment"
|
||||
)
|
||||
|
||||
var debug = false
|
||||
|
||||
// Init initializes settings related to logging
|
||||
func Init(settings *environment.AirshipADMSettings, out io.Writer) {
|
||||
func Init(settings *environment.AirshipCTLSettings, out io.Writer) {
|
||||
debug = settings.Debug
|
||||
log.SetOutput(out)
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/ian-howell/airshipadm/pkg/environment"
|
||||
"github.com/ian-howell/airshipadm/pkg/log"
|
||||
"github.com/ian-howell/airshipctl/pkg/environment"
|
||||
"github.com/ian-howell/airshipctl/pkg/log"
|
||||
)
|
||||
|
||||
const notEqualFmt = `Output does not match expected
|
||||
@ -14,7 +14,7 @@ GOT: %v
|
||||
Expected: %v`
|
||||
|
||||
func TestLoggingWithoutDebug(t *testing.T) {
|
||||
settings := environment.AirshipADMSettings{
|
||||
settings := environment.AirshipCTLSettings{
|
||||
Debug: false,
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ func TestLoggingWithoutDebug(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoggingWithDebug(t *testing.T) {
|
||||
settings := environment.AirshipADMSettings{
|
||||
settings := environment.AirshipCTLSettings{
|
||||
Debug: true,
|
||||
}
|
||||
|
||||
|
@ -5,11 +5,11 @@ import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/ian-howell/airshipadm/pkg/util"
|
||||
"github.com/ian-howell/airshipctl/pkg/util"
|
||||
)
|
||||
|
||||
func TestIsReadable(t *testing.T) {
|
||||
file, err := ioutil.TempFile(os.TempDir(), "airshipadm")
|
||||
file, err := ioutil.TempFile(os.TempDir(), "airshipctl")
|
||||
if err != nil {
|
||||
t.Fatalf("Unexpected error: %s", err.Error())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user