Skip to content

Commit

Permalink
Merge pull request #363 from flanksource/feat/mask-filter-expr
Browse files Browse the repository at this point in the history
feat: mask selector cel expression
  • Loading branch information
moshloop authored Jan 24, 2024
2 parents 5fa7f2b + 775b396 commit f886eff
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 108 deletions.
21 changes: 5 additions & 16 deletions api/v1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,17 @@ func (s Script) String() string {
return ""
}

type MaskSelector struct {
// Type is the config type to apply the mask
Type string `json:"type,omitempty"`
}

func (s MaskSelector) IsEmpty() bool {
return s.Type == ""
}

func (s MaskSelector) String() string {
return fmt.Sprintf("type=%s", s.Type)
}

type Mask struct {
Selector MaskSelector `json:"selector,omitempty"`
JSONPath string `json:"jsonpath,omitempty"`
// Selector is a CEL expression that selects on what config items to apply the mask.
Selector string `json:"selector,omitempty"`
// JSONPath specifies what field in the config needs to be masked
JSONPath string `json:"jsonpath,omitempty"`
// Value can be a hash function name or just a string
Value string `json:"value,omitempty"`
}

func (s Mask) IsEmpty() bool {
return s.Selector.IsEmpty() && s.JSONPath == "" && s.Value == ""
return s.Selector == "" && s.JSONPath == "" && s.Value == ""
}

func (s Mask) String() string {
Expand Down
16 changes: 0 additions & 16 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 45 additions & 54 deletions chart/crds/configs.flanksource.com_scrapeconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -326,14 +326,13 @@ spec:
items:
properties:
jsonpath:
description: JSONPath specifies what field in the
config needs to be masked
type: string
selector:
properties:
type:
description: Type is the config type to apply
the mask
type: string
type: object
description: Selector is a CEL expression that selects
on what config items to apply the mask.
type: string
value:
description: Value can be a hash function name or
just a string
Expand Down Expand Up @@ -609,14 +608,13 @@ spec:
items:
properties:
jsonpath:
description: JSONPath specifies what field in the
config needs to be masked
type: string
selector:
properties:
type:
description: Type is the config type to apply
the mask
type: string
type: object
description: Selector is a CEL expression that selects
on what config items to apply the mask.
type: string
value:
description: Value can be a hash function name or
just a string
Expand Down Expand Up @@ -843,14 +841,13 @@ spec:
items:
properties:
jsonpath:
description: JSONPath specifies what field in the
config needs to be masked
type: string
selector:
properties:
type:
description: Type is the config type to apply
the mask
type: string
type: object
description: Selector is a CEL expression that selects
on what config items to apply the mask.
type: string
value:
description: Value can be a hash function name or
just a string
Expand Down Expand Up @@ -1035,14 +1032,13 @@ spec:
items:
properties:
jsonpath:
description: JSONPath specifies what field in the
config needs to be masked
type: string
selector:
properties:
type:
description: Type is the config type to apply
the mask
type: string
type: object
description: Selector is a CEL expression that selects
on what config items to apply the mask.
type: string
value:
description: Value can be a hash function name or
just a string
Expand Down Expand Up @@ -1267,14 +1263,13 @@ spec:
items:
properties:
jsonpath:
description: JSONPath specifies what field in the
config needs to be masked
type: string
selector:
properties:
type:
description: Type is the config type to apply
the mask
type: string
type: object
description: Selector is a CEL expression that selects
on what config items to apply the mask.
type: string
value:
description: Value can be a hash function name or
just a string
Expand Down Expand Up @@ -1581,14 +1576,13 @@ spec:
items:
properties:
jsonpath:
description: JSONPath specifies what field in the
config needs to be masked
type: string
selector:
properties:
type:
description: Type is the config type to apply
the mask
type: string
type: object
description: Selector is a CEL expression that selects
on what config items to apply the mask.
type: string
value:
description: Value can be a hash function name or
just a string
Expand Down Expand Up @@ -1784,14 +1778,13 @@ spec:
items:
properties:
jsonpath:
description: JSONPath specifies what field in the
config needs to be masked
type: string
selector:
properties:
type:
description: Type is the config type to apply
the mask
type: string
type: object
description: Selector is a CEL expression that selects
on what config items to apply the mask.
type: string
value:
description: Value can be a hash function name or
just a string
Expand Down Expand Up @@ -2080,14 +2073,13 @@ spec:
items:
properties:
jsonpath:
description: JSONPath specifies what field in the
config needs to be masked
type: string
selector:
properties:
type:
description: Type is the config type to apply
the mask
type: string
type: object
description: Selector is a CEL expression that selects
on what config items to apply the mask.
type: string
value:
description: Value can be a hash function name or
just a string
Expand Down Expand Up @@ -2295,14 +2287,13 @@ spec:
items:
properties:
jsonpath:
description: JSONPath specifies what field in the
config needs to be masked
type: string
selector:
properties:
type:
description: Type is the config type to apply
the mask
type: string
type: object
description: Selector is a CEL expression that selects
on what config items to apply the mask.
type: string
value:
description: Value can be a hash function name or
just a string
Expand Down
Loading

0 comments on commit f886eff

Please sign in to comment.