Skip to content

Commit

Permalink
Implement MetadataClient (kyverno#257)
Browse files Browse the repository at this point in the history
* Implement MetadataClient

Signed-off-by: Frank Jogeleit <[email protected]>
  • Loading branch information
fjogeleit authored Feb 8, 2023
1 parent b96b1b2 commit f3b980b
Show file tree
Hide file tree
Showing 92 changed files with 1,028 additions and 575 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,11 @@ docker-push:
.PHONY: docker-push-dev
docker-push-dev:
@docker buildx build --progress plane --platform $(PLATFORMS) --tag $(REPO):dev . --build-arg LD_FLAGS=$(LD_FLAGS) --push

.PHONY: fmt
fmt:
$(call print-target)
@echo "Running gci"
@go run github.com/daixiang0/[email protected] write -s standard -s default -s "prefix(github.com/kyverno/policy-reporter)" .
@echo "Running gofumpt"
@go run mvdan.cc/[email protected] -w .
17 changes: 8 additions & 9 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"flag"
"log"

"github.com/kyverno/policy-reporter/pkg/config"
"github.com/kyverno/policy-reporter/pkg/listener"

"github.com/spf13/cobra"
"golang.org/x/sync/errgroup"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/klog"

"github.com/kyverno/policy-reporter/pkg/config"
"github.com/kyverno/policy-reporter/pkg/listener"
)

func newRunCMD() *cobra.Command {
Expand Down Expand Up @@ -103,13 +103,12 @@ func newRunCMD() *cobra.Command {

g.Go(server.Start)

stop := make(chan struct{})
defer close(stop)
g.Go(func() error {
stop := make(chan struct{})
defer close(stop)

err = client.Run(stop)
if err != nil {
return err
}
return client.Run(stop)
})

return g.Wait()
},
Expand Down
3 changes: 2 additions & 1 deletion cmd/send.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package cmd
import (
"flag"

"github.com/kyverno/policy-reporter/cmd/send"
"github.com/spf13/cobra"

"github.com/kyverno/policy-reporter/cmd/send"
)

func newSendCMD() *cobra.Command {
Expand Down
6 changes: 3 additions & 3 deletions cmd/send/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"strings"
"sync"

"github.com/kyverno/policy-reporter/pkg/config"
"github.com/kyverno/policy-reporter/pkg/email/summary"

"github.com/spf13/cobra"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"

"github.com/kyverno/policy-reporter/pkg/config"
"github.com/kyverno/policy-reporter/pkg/email/summary"
)

func NewSummaryCMD() *cobra.Command {
Expand Down
6 changes: 3 additions & 3 deletions cmd/send/violations.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"strings"
"sync"

"github.com/kyverno/policy-reporter/pkg/config"
"github.com/kyverno/policy-reporter/pkg/email/violations"

"github.com/spf13/cobra"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"

"github.com/kyverno/policy-reporter/pkg/config"
"github.com/kyverno/policy-reporter/pkg/email/violations"
)

func NewViolationsCMD() *cobra.Command {
Expand Down
39 changes: 18 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/kyverno/policy-reporter
go 1.19

require (
github.com/aws/aws-sdk-go v1.44.152
github.com/aws/aws-sdk-go v1.44.196
github.com/go-redis/redis/v8 v8.11.5
github.com/kyverno/go-wildcard v1.0.5
github.com/mattn/go-sqlite3 v1.14.16
Expand All @@ -12,11 +12,11 @@ require (
github.com/prometheus/client_model v0.3.0
github.com/segmentio/fasthash v1.0.3
github.com/spf13/cobra v1.6.1
github.com/spf13/viper v1.14.0
github.com/spf13/viper v1.15.0
github.com/xhit/go-simple-mail/v2 v2.13.0
golang.org/x/sync v0.1.0
k8s.io/apimachinery v0.25.4
k8s.io/client-go v0.25.4
k8s.io/apimachinery v0.26.1
k8s.io/client-go v0.26.1
k8s.io/klog v1.0.0
)

Expand All @@ -28,7 +28,7 @@ require (
github.com/emicklei/go-restful/v3 v3.10.1 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/go-test/deep v1.0.8 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand All @@ -41,51 +41,48 @@ require (
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/onsi/ginkgo/v2 v2.3.0 // indirect
github.com/onsi/gomega v1.22.1 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/spf13/afero v1.9.3 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/toorop/go-dkim v0.0.0-20201103131630-e1cd1a0a5208 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.6.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 // indirect
k8s.io/klog/v2 v2.90.0 // indirect
k8s.io/utils v0.0.0-20230202215443-34013725500c // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)

require (
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/google/gnostic v0.6.9 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/oauth2 v0.2.0 // indirect
golang.org/x/term v0.4.0 // indirect
golang.org/x/time v0.2.0 // indirect
golang.org/x/oauth2 v0.4.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/time v0.3.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
k8s.io/api v0.25.4
k8s.io/kube-openapi v0.0.0-20221202012554-9a5fe2dc74e8 // indirect
k8s.io/api v0.26.1
k8s.io/kube-openapi v0.0.0-20230202010329-39b3636cbaa3 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
)
Loading

0 comments on commit f3b980b

Please sign in to comment.