Skip to content

Commit

Permalink
Merge vmware-archive#246 to support CRDs in fork
Browse files Browse the repository at this point in the history
  • Loading branch information
Astha-Sharma committed Mar 7, 2022
1 parent aa01230 commit f20b6f1
Show file tree
Hide file tree
Showing 5 changed files with 958 additions and 169 deletions.
14 changes: 13 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"path/filepath"
"runtime"

nyaml "github.com/ghodss/yaml"
"gopkg.in/yaml.v3"
)

Expand Down Expand Up @@ -75,11 +76,22 @@ type Config struct {
// Resources to watch.
Resource Resource `json:"resource"`

// For watching specific CRD and CRD.
CRD *TypedReference `json:"crd,omitempty"`

// For watching specific namespace, leave it empty for watching all.
// this config is ignored when watching namespaces
Namespace string `json:"namespace,omitempty"`
}

type TypedReference struct {
// APIVersion of the referenced object.
APIVersion string `json:"apiVersion" yaml:"apiVersion"`

// Kind of the referenced object.
Kind string `json:"kind"`
}

// Slack contains slack configuration
type Slack struct {
// Slack "legacy" API token.
Expand Down Expand Up @@ -202,7 +214,7 @@ func (c *Config) Load() error {
}

if len(b) != 0 {
return yaml.Unmarshal(b, c)
return nyaml.Unmarshal(b, c)
}

return nil
Expand Down
19 changes: 19 additions & 0 deletions examples/conf/kubewatch.conf.crd.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
handler:
slack:
token: ""
channel: ""
hipchat:
token: ""
room: ""
url: ""
mattermost:
channel: ""
url: ""
username: ""
flock:
url: ""
webhook:
url: "http://localhost:8080"
crd:
apiVersion: core.oam.dev/v1alpha2
kind: ApplicationConfiguration
33 changes: 9 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,18 @@ go 1.14

require (
github.com/fatih/structtag v1.2.0
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.4.2 // indirect
github.com/ghodss/yaml v1.0.0
github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 // indirect
github.com/googleapis/gnostic v0.1.0 // indirect
github.com/hashicorp/hcl v0.0.0-20171017181929-23c074d0eceb // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/magiconair/properties v1.7.4 // indirect
github.com/mitchellh/mapstructure v0.0.0-20180111000720-b4575eea38cc // indirect
github.com/mkmik/multierror v0.3.0
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
github.com/pelletier/go-toml v1.0.1 // indirect
github.com/segmentio/textio v1.2.0
github.com/sirupsen/logrus v1.6.0
github.com/sirupsen/logrus v1.8.1
github.com/slack-go/slack v0.6.5
github.com/spf13/cast v1.1.0 // indirect
github.com/spf13/cobra v0.0.1
github.com/spf13/jwalterweatherman v0.0.0-20180109140146-7c0cea34c8ec // indirect
github.com/spf13/viper v1.0.0
github.com/stretchr/testify v1.6.1 // indirect
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.8.1
github.com/tbruyelle/hipchat-go v0.0.0-20160921153256-749fb9e14beb
golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 // indirect
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 // indirect
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
k8s.io/api v0.16.8
k8s.io/apimachinery v0.16.8
k8s.io/client-go v0.16.8
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
k8s.io/api v0.23.0
k8s.io/apimachinery v0.23.0
k8s.io/client-go v0.23.0
sigs.k8s.io/controller-runtime v0.11.1
)
Loading

0 comments on commit f20b6f1

Please sign in to comment.