Skip to content

Commit

Permalink
Release 5.6.0 (#2897)
Browse files Browse the repository at this point in the history
* Create 5.6.0 release branch

Signed-off-by: Eric Chlebek <eric@sensu.io>

* Bugfix for annotations & labels flags (#2881)

Signed-off-by: Simon Plourde <simon@sensu.io>

* Move dashboard source code into its own repository (#2869)

As our project has grown, build targets increased, and time has passed, the ideal of a monorepo housing both the web and backend has simply caused more friction than it has reduced. Today we are moving Sensu Go Web into it's own repository: sensu/web.

Signed-off-by: James Phillips <jamesdphillips@gmail.com>

* [GraphQL] Ensures that all types are registered (#2875)

Types that are not directly referenced by the root Schema type or any of
their children are not immediately registered with the schema. As such to
ensure that ALL types are available we append any that are missing.

Signed-off-by: James Phillips <jamesdphillips@gmail.com>

* Add message bus to tessend (#2886)

Signed-off-by: Nikki Attea <nikki@sensu.io>

* Feature/cluster id hex (#2893)

Signed-off-by: Nikki Attea <nikki@sensu.io>

* Add support for field selectors (#2892)

Signed-off-by: Simon Plourde <simon@sensu.io>

* Proxy api from dashboard daemon (#2885)

Signed-off-by: James Phillips <jamesdphillips@gmail.com>
  • Loading branch information
echlebek committed Apr 25, 2019
1 parent d77cac2 commit 9dfb8d2
Show file tree
Hide file tree
Showing 499 changed files with 1,220 additions and 35,530 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic
Versioning](http://semver.org/spec/v2.0.0.html).

## [5.6.0] - TBD

### Added
- Added fields getter functions for resources available via the REST API.

### Fixed
- Fixed the agent `--annotations` and `--labels` flags.

### Added
- Added the message bus to Tessend in order to track Tessen configuration changes from the API.
- Added a performance optimizing `Count()` function to the generic store.
- Added a hexadecimal Cluster ID title to the `sensuctl cluster health` and
`sensuctl cluster member-list` commands in tabular format.
- Added a `Header` field to the `HealthResponse` type returned by `/health`.

## [5.5.1] - 2019-04-15

### Changed
Expand Down
17 changes: 15 additions & 2 deletions agent/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import (

var (
logger *logrus.Entry

annotations map[string]string
labels map[string]string
)

const (
Expand Down Expand Up @@ -164,6 +167,16 @@ func newStartCommand() *cobra.Command {
cfg.Redact = viper.GetStringSlice(flagRedact)
cfg.Subscriptions = viper.GetStringSlice(flagSubscriptions)

// Workaround for https://github.com/sensu/sensu-go/issues/2357. Detect if
// the flags for labels and annotations were changed. If so, use their
// values since flags take precedence over config
if flag := cmd.Flags().Lookup(flagLabels); flag != nil && flag.Changed {
cfg.Labels = labels
}
if flag := cmd.Flags().Lookup(flagAnnotations); flag != nil && flag.Changed {
cfg.Annotations = annotations
}

sensuAgent, err := agent.NewAgent(cfg)
if err != nil {
return err
Expand Down Expand Up @@ -279,8 +292,8 @@ func newStartCommand() *cobra.Command {
cmd.Flags().String(flagTrustedCAFile, viper.GetString(flagTrustedCAFile), "TLS CA certificate bundle in PEM format")
cmd.Flags().Bool(flagInsecureSkipTLSVerify, viper.GetBool(flagInsecureSkipTLSVerify), "skip TLS verification (not recommended!)")
cmd.Flags().String(flagLogLevel, viper.GetString(flagLogLevel), "logging level [panic, fatal, error, warn, info, debug]")
cmd.Flags().StringToString(flagLabels, viper.GetStringMapString(flagLabels), "entity labels map")
cmd.Flags().StringToString(flagAnnotations, viper.GetStringMapString(flagAnnotations), "entity annotations map")
cmd.Flags().StringToStringVar(&labels, flagLabels, nil, "entity labels map")
cmd.Flags().StringToStringVar(&annotations, flagAnnotations, nil, "entity annotations map")

cmd.Flags().SetNormalizeFunc(aliasNormalizeFunc)

Expand Down
11 changes: 11 additions & 0 deletions api/core/v2/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"net/url"
"path"
"regexp"
"strings"

"github.com/sensu/sensu-go/js"
)
Expand Down Expand Up @@ -101,3 +102,13 @@ func (a *Asset) URIPath() string {
func NewAsset(meta ObjectMeta) *Asset {
return &Asset{ObjectMeta: meta}
}

// AssetFields returns a set of fields that represent that resource
func AssetFields(r Resource) map[string]string {
resource := r.(*Asset)
return map[string]string{
"asset.name": resource.ObjectMeta.Name,
"asset.namespace": resource.ObjectMeta.Namespace,
"asset.filters": strings.Join(resource.Filters, ","),
}
}
16 changes: 16 additions & 0 deletions api/core/v2/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"
"net/url"
"sort"
"strconv"
"strings"
"time"

jsoniter "github.com/json-iterator/go"
Expand Down Expand Up @@ -452,3 +454,17 @@ func (c *CheckConfig) IsSubdued() bool {
}
return subdued
}

// CheckConfigFields returns a set of fields that represent that resource
func CheckConfigFields(r Resource) map[string]string {
resource := r.(*CheckConfig)
return map[string]string{
"check.name": resource.ObjectMeta.Name,
"check.namespace": resource.ObjectMeta.Namespace,
"check.handlers": strings.Join(resource.Handlers, ","),
"check.publish": strconv.FormatBool(resource.Publish),
"check.round_robin": strconv.FormatBool(resource.RoundRobin),
"check.runtime_assets": strings.Join(resource.RuntimeAssets, ","),
"check.subscriptions": strings.Join(resource.Subscriptions, ","),
}
}
14 changes: 14 additions & 0 deletions api/core/v2/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"fmt"
"net/url"
"sort"
"strconv"
"strings"

utilstrings "github.com/sensu/sensu-go/util/strings"
)
Expand Down Expand Up @@ -169,3 +171,15 @@ func (s *entitySorter) Swap(i, j int) {
func (s *entitySorter) Less(i, j int) bool {
return s.byFn(s.entities[i], s.entities[j])
}

// EntityFields returns a set of fields that represent that resource
func EntityFields(r Resource) map[string]string {
resource := r.(*Entity)
return map[string]string{
"entity.name": resource.ObjectMeta.Name,
"entity.namespace": resource.ObjectMeta.Namespace,
"entity.deregister": strconv.FormatBool(resource.Deregister),
"entity.entity_class": resource.EntityClass,
"entity.subscriptions": strings.Join(resource.Subscriptions, ","),
}
}
22 changes: 21 additions & 1 deletion api/core/v2/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
fmt "fmt"
"net/url"
"sort"
"strconv"
"strings"
"time"

stringsutil "github.com/sensu/sensu-go/util/strings"
Expand Down Expand Up @@ -106,7 +108,7 @@ func (e *Event) IsSilenced() bool {
return len(e.Check.Silenced) > 0
}

// Implements dynamic.SynthesizeExtras
// SynthesizeExtras implements dynamic.SynthesizeExtras
func (e *Event) SynthesizeExtras() map[string]interface{} {
return map[string]interface{}{
"has_check": e.HasCheck(),
Expand Down Expand Up @@ -349,3 +351,21 @@ func (e *Event) IsSilencedBy(entry *Silenced) bool {

return false
}

// EventFields returns a set of fields that represent that resource
func EventFields(r Resource) map[string]string {
resource := r.(*Event)
return map[string]string{
"event.name": resource.ObjectMeta.Name,
"event.namespace": resource.ObjectMeta.Namespace,
"event.check.handlers": strings.Join(resource.Check.Handlers, ","),
"event.check.publish": strconv.FormatBool(resource.Check.Publish),
"event.check.round_robin": strconv.FormatBool(resource.Check.RoundRobin),
"event.check.runtime_assets": strings.Join(resource.Check.RuntimeAssets, ","),
"event.check.status": strconv.Itoa(int(resource.Check.Status)),
"event.check.subscriptions": strings.Join(resource.Check.Subscriptions, ","),
"event.entity.deregister": strconv.FormatBool(resource.Entity.Deregister),
"event.entity.entity_class": resource.Entity.EntityClass,
"event.entity.subscriptions": strings.Join(resource.Entity.Subscriptions, ","),
}
}
10 changes: 10 additions & 0 deletions api/core/v2/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ func FixtureExtension(name string) *Extension {
}
}

// NewExtension intializes an extension with the given object meta
func NewExtension(meta ObjectMeta) *Extension {
return &Extension{ObjectMeta: meta}
}

// ExtensionFields returns a set of fields that represent that resource
func ExtensionFields(r Resource) map[string]string {
resource := r.(*Extension)
return map[string]string{
"extension.name": resource.ObjectMeta.Name,
"extension.namespace": resource.ObjectMeta.Namespace,
}
}
12 changes: 12 additions & 0 deletions api/core/v2/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"net/url"
"strings"

"github.com/sensu/sensu-go/js"
utilstrings "github.com/sensu/sensu-go/util/strings"
Expand Down Expand Up @@ -103,3 +104,14 @@ func FixtureDenyEventFilter(name string) *EventFilter {
func (f *EventFilter) URIPath() string {
return fmt.Sprintf("/api/core/v2/namespaces/%s/filters/%s", url.PathEscape(f.Namespace), url.PathEscape(f.Name))
}

// EventFilterFields returns a set of fields that represent that resource
func EventFilterFields(r Resource) map[string]string {
resource := r.(*EventFilter)
return map[string]string{
"filter.name": resource.ObjectMeta.Name,
"filter.namespace": resource.ObjectMeta.Namespace,
"filter.action": resource.Action,
"filter.runtime_assets": strings.Join(resource.RuntimeAssets, ","),
}
}
14 changes: 14 additions & 0 deletions api/core/v2/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
fmt "fmt"
"net/url"
"strings"
)

const (
Expand Down Expand Up @@ -110,3 +111,16 @@ func FixtureSetHandler(name string, handlers ...string) *Handler {
func (h *Handler) URIPath() string {
return fmt.Sprintf("/api/core/v2/namespaces/%s/handlers/%s", url.PathEscape(h.Namespace), url.PathEscape(h.Name))
}

// HandlerFields returns a set of fields that represent that resource
func HandlerFields(r Resource) map[string]string {
resource := r.(*Handler)
return map[string]string{
"handler.name": resource.ObjectMeta.Name,
"handler.namespace": resource.ObjectMeta.Namespace,
"handler.filters": strings.Join(resource.Filters, ","),
"handler.handlers": strings.Join(resource.Handlers, ","),
"handler.mutator": resource.Mutator,
"handler.type": resource.Type,
}
}
9 changes: 8 additions & 1 deletion api/core/v2/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ type HealthResponse struct {
Alarms []*etcdserverpb.AlarmMember
// ClusterHealth is the list of health status for every cluster member.
ClusterHealth []*ClusterHealth
// Header is the response header for the entire cluster response.
Header *etcdserverpb.ResponseHeader
}

// FixtureHealthResponse returns a HealthResponse fixture for testing.
func FixtureHealthResponse(healthy bool) *HealthResponse {
var err string
healthResponse := &HealthResponse{}
healthResponse := &HealthResponse{
Header: &etcdserverpb.ResponseHeader{
ClusterId: uint64(4255616304056076734),
},
}

clusterHealth := []*ClusterHealth{}
clusterHealth = append(clusterHealth, &ClusterHealth{
MemberID: uint64(12345),
Expand Down
9 changes: 9 additions & 0 deletions api/core/v2/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,12 @@ func FixtureHookList(hookName string) *HookList {
func (h *Hook) URIPath() string {
return fmt.Sprintf("/api/core/v2/namespaces/%s/hooks/%s", url.PathEscape(h.Namespace), url.PathEscape(h.Name))
}

// HookConfigFields returns a set of fields that represent that resource
func HookConfigFields(r Resource) map[string]string {
resource := r.(*HookConfig)
return map[string]string{
"hook.name": resource.ObjectMeta.Name,
"hook.namespace": resource.ObjectMeta.Namespace,
}
}
11 changes: 11 additions & 0 deletions api/core/v2/mutator.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
fmt "fmt"
"net/url"
"strings"
)

// NewMutator creates a new Mutator.
Expand Down Expand Up @@ -59,3 +60,13 @@ func FixtureMutator(name string) *Mutator {
func (m *Mutator) URIPath() string {
return fmt.Sprintf("/api/core/v2/namespaces/%s/mutators/%s", url.PathEscape(m.Namespace), url.PathEscape(m.Name))
}

// MutatorFields returns a set of fields that represent that resource
func MutatorFields(r Resource) map[string]string {
resource := r.(*Mutator)
return map[string]string{
"mutator.name": resource.ObjectMeta.Name,
"mutator.namespace": resource.ObjectMeta.Namespace,
"mutator.runtime_assets": strings.Join(resource.RuntimeAssets, ","),
}
}
8 changes: 8 additions & 0 deletions api/core/v2/namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ func (n *Namespace) URIPath() string {
func (n *Namespace) GetObjectMeta() ObjectMeta {
return ObjectMeta{}
}

// NamespaceFields returns a set of fields that represent that resource
func NamespaceFields(r Resource) map[string]string {
resource := r.(*Namespace)
return map[string]string{
"namespace.name": resource.Name,
}
}
38 changes: 38 additions & 0 deletions api/core/v2/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,41 @@ func NewRole(meta ObjectMeta) *Role {
func NewRoleBinding(meta ObjectMeta) *RoleBinding {
return &RoleBinding{ObjectMeta: meta}
}

// ClusterRoleFields returns a set of fields that represent that resource
func ClusterRoleFields(r Resource) map[string]string {
resource := r.(*ClusterRole)
return map[string]string{
"clusterrole.name": resource.ObjectMeta.Name,
}
}

// ClusterRoleBindingFields returns a set of fields that represent that resource
func ClusterRoleBindingFields(r Resource) map[string]string {
resource := r.(*ClusterRoleBinding)
return map[string]string{
"clusterrolebinding.name": resource.ObjectMeta.Name,
"clusterrolebinding.role_ref.name": resource.RoleRef.Name,
"clusterrolebinding.role_ref.type": resource.RoleRef.Type,
}
}

// RoleFields returns a set of fields that represent that resource
func RoleFields(r Resource) map[string]string {
resource := r.(*Role)
return map[string]string{
"role.name": resource.ObjectMeta.Name,
"role.namespace": resource.ObjectMeta.Namespace,
}
}

// RoleBindingFields returns a set of fields that represent that resource
func RoleBindingFields(r Resource) map[string]string {
resource := r.(*RoleBinding)
return map[string]string{
"rolebinding.name": resource.ObjectMeta.Name,
"rolebinding.namespace": resource.ObjectMeta.Namespace,
"rolebinding.role_ref.name": resource.RoleRef.Name,
"rolebinding.role_ref.type": resource.RoleRef.Type,
}
}
14 changes: 14 additions & 0 deletions api/core/v2/silenced.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/url"
"sort"
"strconv"
"strings"
)

Expand Down Expand Up @@ -124,3 +125,16 @@ func (s *silenceSorter) Swap(i, j int) {
func (s *silenceSorter) Less(i, j int) bool {
return s.byFn(s.silences[i], s.silences[j])
}

// SilencedFields returns a set of fields that represent that resource
func SilencedFields(r Resource) map[string]string {
resource := r.(*Silenced)
return map[string]string{
"silenced.name": resource.ObjectMeta.Name,
"silenced.namespace": resource.ObjectMeta.Namespace,
"silenced.check": resource.Check,
"silenced.creator": resource.Creator,
"silenced.expire_on_resolve": strconv.FormatBool(resource.ExpireOnResolve),
"silenced.subscription": resource.Subscription,
}
}
3 changes: 2 additions & 1 deletion api/core/v2/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ var (
// PCI compliance as of Jun 30, 2018: anything under TLS 1.1 must be disabled
// we bump this up to TLS 1.2 so we can support the best possible ciphers
tlsMinVersion = uint16(tls.VersionTLS12)
// disable CBC suites (Lucky13 attack) this means TLS 1.1 can't work (no GCM)
// DefaultCipherSuites overrides the default cipher suites in order to disable
// CBC suites (Lucky13 attack) this means TLS 1.1 can't work (no GCM)
// additionally, we should only use perfect forward secrecy ciphers
DefaultCipherSuites = []uint16{
tls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
Expand Down

0 comments on commit 9dfb8d2

Please sign in to comment.