Skip to content

Commit a048b28

Browse files
Merge pull request #29955 from mdbooth/resourcewatch
NO-JIRA: Improve performance of run-resourcewatch
2 parents 6a5d795 + 7526f99 commit a048b28

File tree

14 files changed

+982
-638
lines changed

14 files changed

+982
-638
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ require (
2121
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
2222
github.com/go-bindata/go-bindata v3.1.2+incompatible
2323
github.com/go-ldap/ldap/v3 v3.4.3
24+
github.com/go-logr/logr v1.4.2
2425
github.com/golang/protobuf v1.5.4
2526
github.com/google/gnostic-models v0.6.8
2627
github.com/google/go-cmp v0.6.0
@@ -172,7 +173,6 @@ require (
172173
github.com/go-errors/errors v1.4.2 // indirect
173174
github.com/go-fonts/liberation v0.3.1 // indirect
174175
github.com/go-latex/latex v0.0.0-20230307184459-12ec69307ad9 // indirect
175-
github.com/go-logr/logr v1.4.2 // indirect
176176
github.com/go-logr/stdr v1.2.2 // indirect
177177
github.com/go-openapi/jsonpointer v0.21.0 // indirect
178178
github.com/go-openapi/jsonreference v0.21.0 // indirect

pkg/cmd/openshift-tests/run_resource_watch/resourcewatch.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
package run_resource_watch
22

33
import (
4+
"fmt"
5+
46
"github.com/openshift/origin/pkg/resourcewatch/operator"
57
"github.com/spf13/cobra"
68
"k8s.io/kubectl/pkg/util/templates"
79
)
810

911
func NewRunResourceWatchCommand() *cobra.Command {
12+
var toJsonPath, fromJsonPath string
13+
1014
cmd := &cobra.Command{
1115
Use: "run-resourcewatch",
1216
Short: "Run watch for resource changes and commit each to a git repository",
@@ -22,12 +26,22 @@ func NewRunResourceWatchCommand() *cobra.Command {
2226

2327
SilenceUsage: true,
2428
SilenceErrors: true,
29+
PreRunE: func(cmd *cobra.Command, args []string) error {
30+
// Check for mutual exclusivity of --to-json and --from-json
31+
if toJsonPath != "" && fromJsonPath != "" {
32+
return fmt.Errorf("--to-json and --from-json are mutually exclusive")
33+
}
34+
return nil
35+
},
2536
RunE: func(cmd *cobra.Command, args []string) error {
26-
return operator.RunResourceWatch()
37+
return operator.RunResourceWatch(toJsonPath, fromJsonPath)
2738
},
2839
}
2940
var dummy string
3041
cmd.Flags().StringVar(&dummy, "kubeconfig", "", "This option is not used any more. It will be removed in later releases")
3142
cmd.Flags().StringVar(&dummy, "namespace", "", "This option is not used any more. It will be removed in later releases")
43+
cmd.Flags().StringVar(&toJsonPath, "to-json", "", "Path to JSON file for output (mutually exclusive with --from-json)")
44+
cmd.Flags().StringVar(&fromJsonPath, "from-json", "", "Path to JSON file for input (mutually exclusive with --to-json)")
45+
3246
return cmd
3347
}

pkg/resourcewatch/controller/configmonitor/crd_controller.go

Lines changed: 0 additions & 47 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package storage
1+
package git
22

33
import (
44
"encoding/json"

0 commit comments

Comments
 (0)