Skip to content

Commit

Permalink
feat(*) update project to build kumactl at windows
Browse files Browse the repository at this point in the history
Signed-off-by: Bart Smykla <bartek@smykla.com>
  • Loading branch information
bartsmykla committed Aug 18, 2021
1 parent 19f4803 commit 639327a
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 10 deletions.
14 changes: 14 additions & 0 deletions app/kumactl/cmd/additional_subcommands.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// +build !windows

package cmd

import (
"github.com/spf13/cobra"

"github.com/kumahq/kuma/app/kumactl/cmd/uninstall"
kumactl_cmd "github.com/kumahq/kuma/app/kumactl/pkg/cmd"
)

var additionalSubcommands = []func(*kumactl_cmd.RootContext) *cobra.Command{
uninstall.NewUninstallCmd,
}
18 changes: 18 additions & 0 deletions app/kumactl/cmd/additional_subcommands_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/kumahq/kuma/app/kumactl/cmd/apply"
"github.com/kumahq/kuma/app/kumactl/cmd/completion"
"github.com/kumahq/kuma/app/kumactl/cmd/config"
"github.com/kumahq/kuma/app/kumactl/cmd/delete"
"github.com/kumahq/kuma/app/kumactl/cmd/generate"
"github.com/kumahq/kuma/app/kumactl/cmd/get"
"github.com/kumahq/kuma/app/kumactl/cmd/inspect"
"github.com/kumahq/kuma/app/kumactl/cmd/install"
"github.com/kumahq/kuma/pkg/cmd/version"
"github.com/spf13/cobra"

kumactl_cmd "github.com/kumahq/kuma/app/kumactl/pkg/cmd"
)

var additionalSubcommands []func(*kumactl_cmd.RootContext) *cobra.Command
11 changes: 11 additions & 0 deletions app/kumactl/cmd/install/additional_subcommands.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// +build !windows

package install

import (
"github.com/spf13/cobra"
)

var additionalSubcommands = []func() *cobra.Command{
newInstallTransparentProxy,
}
7 changes: 7 additions & 0 deletions app/kumactl/cmd/install/additional_subcommands_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package install

import (
"github.com/spf13/cobra"
)

var additionalSubcommands []func() *cobra.Command
7 changes: 6 additions & 1 deletion app/kumactl/cmd/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,20 @@ func NewInstallCmd(pctx *kumactl_cmd.RootContext) *cobra.Command {
Short: "Install various Kuma components.",
Long: `Install various Kuma components.`,
}

// sub-commands
cmd.AddCommand(newInstallControlPlaneCmd(&pctx.InstallCpContext))
cmd.AddCommand(newInstallCrdsCmd(&pctx.InstallCRDContext))
cmd.AddCommand(newInstallMetrics(pctx))
cmd.AddCommand(newInstallTracing(pctx))
cmd.AddCommand(newInstallDNS())
cmd.AddCommand(newInstallLogging(pctx))
cmd.AddCommand(newInstallTransparentProxy())
cmd.AddCommand(newInstallDemoCmd(&pctx.InstallDemoContext))
cmd.AddCommand(newInstallGatewayCmd(pctx))

for _, subcommand := range additionalSubcommands {
cmd.AddCommand(subcommand())
}

return cmd
}
2 changes: 2 additions & 0 deletions app/kumactl/cmd/install/install_transparent_proxy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !windows

package install

import (
Expand Down
7 changes: 5 additions & 2 deletions app/kumactl/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/kumahq/kuma/app/kumactl/cmd/get"
"github.com/kumahq/kuma/app/kumactl/cmd/inspect"
"github.com/kumahq/kuma/app/kumactl/cmd/install"
"github.com/kumahq/kuma/app/kumactl/cmd/uninstall"
kumactl_cmd "github.com/kumahq/kuma/app/kumactl/pkg/cmd"
kumactl_config "github.com/kumahq/kuma/app/kumactl/pkg/config"
kumactl_errors "github.com/kumahq/kuma/app/kumactl/pkg/errors"
Expand Down Expand Up @@ -106,8 +105,12 @@ func NewRootCmd(root *kumactl_cmd.RootContext) *cobra.Command {
cmd.AddCommand(get.NewGetCmd(root))
cmd.AddCommand(inspect.NewInspectCmd(root))
cmd.AddCommand(install.NewInstallCmd(root))
cmd.AddCommand(uninstall.NewUninstallCmd(root))
cmd.AddCommand(version.NewVersionCmd())

for _, subcommand := range additionalSubcommands {
cmd.AddCommand(subcommand(root))
}

kumactl_cmd.WrapRunnables(cmd, kumactl_errors.FormatErrorWrapper)
return cmd
}
Expand Down
9 changes: 9 additions & 0 deletions app/kumactl/cmd/uninstall/subcommands.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// +build !windows

package uninstall

import "github.com/spf13/cobra"

var subcommands = []func() *cobra.Command{
newUninstallTransparentProxy,
}
5 changes: 5 additions & 0 deletions app/kumactl/cmd/uninstall/subcommands_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package uninstall

import "github.com/spf13/cobra"

var subcommands []func() *cobra.Command
6 changes: 5 additions & 1 deletion app/kumactl/cmd/uninstall/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ func NewUninstallCmd(pctx *kumactl_cmd.RootContext) *cobra.Command {
Short: "Uninstall various Kuma components.",
Long: `Uninstall various Kuma components.`,
}

// sub-commands
cmd.AddCommand(newUninstallTransparentProxy())
for _, subcommand := range subcommands {
cmd.AddCommand(subcommand())
}

return cmd
}
4 changes: 2 additions & 2 deletions app/kumactl/cmd/uninstall/uninstall_transparent_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
"github.com/kumahq/kuma/pkg/transparentproxy"
)

type transparenProxyArgs struct {
type transparentProxyArgs struct {
DryRun bool
Verbose bool
}

func newUninstallTransparentProxy() *cobra.Command {
args := transparenProxyArgs{
args := transparentProxyArgs{
DryRun: false,
Verbose: false,
}
Expand Down
19 changes: 19 additions & 0 deletions app/kumactl/cmd/uninstall/uninstall_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// +build !windows

package uninstall

import (
"github.com/spf13/cobra"

kumactl_cmd "github.com/kumahq/kuma/app/kumactl/pkg/cmd"
)

func NewUninstallCmd(pctx *kumactl_cmd.RootContext) *cobra.Command {
cmd := &cobra.Command{
Use: "uninstall",
Short: "Uninstall various Kuma components.",
Long: `Uninstall various Kuma components.`,
}

return cmd
}
8 changes: 4 additions & 4 deletions pkg/config/xds/bootstrap/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ func (b *BootstrapParamsConfig) Validate() error {
return nil
}

func DefaultBootstrapParamsConfig() *BootstrapParamsConfig {
func buildDefaultBootstrapParamsConfig(adminAccessLogPath string) *BootstrapParamsConfig {
return &BootstrapParamsConfig{
AdminAddress: "127.0.0.1", // by default, Envoy Admin interface should listen on loopback address
AdminPort: 0, // by default, turn off Admin interface of Envoy
AdminAccessLogPath: "/dev/null",
XdsHost: "", // by default it is the same host as the one used by kuma-dp to connect to the control plane
XdsPort: 0, // by default it is autoconfigured from KUMA_XDS_SERVER_GRPC_PORT
AdminAccessLogPath: adminAccessLogPath,
XdsHost: "", // by default, it is the same host as the one used by kuma-dp to connect to the control plane
XdsPort: 0, // by default, it is autoconfigured from KUMA_XDS_SERVER_GRPC_PORT
XdsConnectTimeout: 1 * time.Second,
}
}
7 changes: 7 additions & 0 deletions pkg/config/xds/bootstrap/default_params.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build !windows

package bootstrap

func DefaultBootstrapParamsConfig() *BootstrapParamsConfig {
return buildDefaultBootstrapParamsConfig("/dev/null")
}
5 changes: 5 additions & 0 deletions pkg/config/xds/bootstrap/default_params_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package bootstrap

func DefaultBootstrapParamsConfig() *BootstrapParamsConfig {
return buildDefaultBootstrapParamsConfig("NUL")
}

0 comments on commit 639327a

Please sign in to comment.