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

Remove 'controller' and expose API to enable remote apply #272

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cmd/lyra/cmd/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package cmd
import (
"os"

"github.com/lyraproj/lyra/pkg/apply"

"github.com/leonelquinteros/gotext"
"github.com/lyraproj/lyra/cmd/lyra/ui"
"github.com/lyraproj/lyra/pkg/apply"
"github.com/lyraproj/servicesdk/wf"
"github.com/spf13/cobra"

// Ensure that types created by the go lyra package are loaded
Expand Down Expand Up @@ -35,9 +35,9 @@ func NewApplyCmd() *cobra.Command {
}

func runApplyCmd(cmd *cobra.Command, args []string) {
applicator := &apply.Applicator{HomeDir: homeDir, DlvConfig: dlvConfig}
applicator := apply.NewApplicator(homeDir, dlvConfig)
workflowName := args[0]
exitCode := applicator.ApplyWorkflow(workflowName, wf.Upsert)
exitCode := applicator.ApplyWorkflow(workflowName)
if exitCode != 0 {
os.Exit(exitCode)
}
Expand Down
102 changes: 0 additions & 102 deletions cmd/lyra/cmd/controller.go

This file was deleted.

8 changes: 4 additions & 4 deletions cmd/lyra/cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package cmd
import (
"os"

"github.com/lyraproj/lyra/pkg/apply"

"github.com/leonelquinteros/gotext"
"github.com/lyraproj/lyra/cmd/lyra/ui"
"github.com/lyraproj/lyra/pkg/apply"
"github.com/lyraproj/servicesdk/wf"
"github.com/spf13/cobra"
)

Expand All @@ -30,9 +30,9 @@ func NewDeleteCmd() *cobra.Command {
}

func runDeleteCmd(cmd *cobra.Command, args []string) {
applicator := &apply.Applicator{HomeDir: homeDir, DlvConfig: dlvConfig}
applicator := apply.NewApplicator(homeDir, dlvConfig)
workflowName := args[0]
exitCode := applicator.ApplyWorkflow(workflowName, wf.Delete)
exitCode := applicator.DeleteWorkflow(workflowName)
if exitCode != 0 {
os.Exit(exitCode)
}
Expand Down
20 changes: 12 additions & 8 deletions cmd/lyra/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
)

// NewRootCmd returns the root command
func NewRootCmd() *cobra.Command {
func NewRootCmd(subCommands ...*cobra.Command) *cobra.Command {

gotext.Configure("locales", "en_US", "default")

Expand All @@ -41,13 +41,17 @@ func NewRootCmd() *cobra.Command {
cmd.SetHelpTemplate(ansi.Blue + version.LogoFiglet + ansi.Reset + ui.HelpTemplate)
cmd.SetUsageTemplate(ui.UsageTemplate)

cmd.AddCommand(NewVersionCmd())
cmd.AddCommand(NewApplyCmd())
cmd.AddCommand(NewDeleteCmd())
cmd.AddCommand(NewControllerCmd())
// cmd.AddCommand(NewValidateCmd())
cmd.AddCommand(NewGenerateCmd())
// cmd.AddCommand(EmbeddedPluginCmd())
cmd.AddCommand(
NewVersionCmd(),
NewApplyCmd(),
NewDeleteCmd(),
// NewValidateCmd(),
NewGenerateCmd(),
// cmd.AddCommand(EmbeddedPluginCmd())
)
if len(subCommands) > 0 {
cmd.AddCommand(subCommands...)
}

return cmd
}
Expand Down
3 changes: 1 addition & 2 deletions cmd/lyra/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import (
"os"

"github.com/lyraproj/lyra/cmd/lyra/cmd"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
)

func main() {
if err := cmd.NewRootCmd().Execute(); err != nil {
fmt.Fprintln(os.Stderr, err)
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(-1)
}
}
15 changes: 1 addition & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,33 +1,20 @@
module github.com/lyraproj/lyra

require (
github.com/go-logr/logr v0.1.0
github.com/go-logr/zapr v0.1.1 // indirect
github.com/hashicorp/go-hclog v0.9.0
github.com/hashicorp/go-plugin v0.0.0-20190220160451-3f118e8ee104
github.com/hashicorp/terraform v0.11.13 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/hashicorp/go-plugin v1.0.0
github.com/leonelquinteros/gotext v1.4.0
github.com/lyraproj/hiera v0.0.0-20190507134255-7e5f10f74371
github.com/lyraproj/identity v0.0.0-20190508125111-1233fbd7493c
github.com/lyraproj/issue v0.0.0-20190329160035-8bc10230f995
github.com/lyraproj/lyra-operator v0.0.0-20190412150939-82bb153789bc
github.com/lyraproj/pcore v0.0.0-20190510110551-08ede39ae02d
github.com/lyraproj/puppet-workflow v0.0.0-20190510110814-2b8a82d3b710
github.com/lyraproj/servicesdk v0.0.0-20190508121759-aa1c3c39fdcb
github.com/lyraproj/terraform-bridge v0.0.0-20190508125211-3b912f363208
github.com/lyraproj/wfe v0.0.0-20190508124926-84cb6813dc7b
github.com/mattn/go-colorable v0.1.1 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b
github.com/pkg/errors v0.8.1 // indirect
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 // indirect
github.com/prometheus/common v0.2.0 // indirect
github.com/prometheus/procfs v0.0.0-20190209105433-f8d8b3f739bd // indirect
github.com/spf13/cobra v0.0.3
github.com/stretchr/testify v1.3.0
go.uber.org/zap v1.10.0 // indirect
k8s.io/client-go v10.0.0+incompatible
sigs.k8s.io/controller-runtime v0.1.10
)

replace github.com/google/go-github => github.com/google/go-github v16.0.0+incompatible // terraform-bridge GitHub plugin requires this version
Loading