Skip to content

Commit 7271bc1

Browse files
committed
annot-exclusion: use concrete examples such as employee ID and Kapp
I've also reduced the size of the documentation in values.yaml; it now only contains the essential information.
1 parent a20e5a3 commit 7271bc1

File tree

4 files changed

+30
-28
lines changed

4 files changed

+30
-28
lines changed

deploy/charts/venafi-kubernetes-agent/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,9 @@ Control Plane.
431431
432432
You can configure Venafi Kubernetes Agent to exclude some annotations or labels from being pushed to the Venafi Control Plane. All Kubernetes objects are affected. The objects are still pushed, but the specified annotations and labels are removed before being sent to the Venafi Control Plane.
433433
434-
If you would like to exclude annotations keys that contain the word `word`, use the regular expression `.*word.*`. The leading and ending .* are important if you want to filter out keys that contain `word` anywhere in the key string.
434+
Dots is the only character that needs to be escaped in the regex. Use either double quotes with escaped single quotes or unquoted strings for the regex to avoid YAML parsing issues with `\.`.
435435
436-
Note that the annotation `kubectl.kubernetes.io/last-applied-configuration` is already excluded by default, you don't need to exclude it explicitly.
437-
438-
Example: excludeAnnotationKeysRegex: ["kapp\.k14s\.io\/original.*"]
436+
Example: excludeAnnotationKeysRegex: ['^kapp\.k14s\.io/original.*']
439437
#### **config.excludeLabelKeysRegex** ~ `array`
440438
> Default value:
441439
> ```yaml

deploy/charts/venafi-kubernetes-agent/values.schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
"helm-values.config.configmap.name": {},
215215
"helm-values.config.excludeAnnotationKeysRegex": {
216216
"default": [],
217-
"description": "You can configure Venafi Kubernetes Agent to exclude some annotations or labels from being pushed to the Venafi Control Plane. All Kubernetes objects are affected. The objects are still pushed, but the specified annotations and labels are removed before being sent to the Venafi Control Plane.\n\nIf you would like to exclude annotations keys that contain the word `word`, use the regular expression `.*word.*`. The leading and ending .* are important if you want to filter out keys that contain `word` anywhere in the key string.\n\nNote that the annotation `kubectl.kubernetes.io/last-applied-configuration` is already excluded by default, you don't need to exclude it explicitly.\n\nExample: excludeAnnotationKeysRegex: [\"kapp\\.k14s\\.io\\/original.*\"]",
217+
"description": "You can configure Venafi Kubernetes Agent to exclude some annotations or labels from being pushed to the Venafi Control Plane. All Kubernetes objects are affected. The objects are still pushed, but the specified annotations and labels are removed before being sent to the Venafi Control Plane.\n\nDots is the only character that needs to be escaped in the regex. Use either double quotes with escaped single quotes or unquoted strings for the regex to avoid YAML parsing issues with `\\.`.\n\nExample: excludeAnnotationKeysRegex: ['^kapp\\.k14s\\.io/original.*']",
218218
"items": {},
219219
"type": "array"
220220
},

deploy/charts/venafi-kubernetes-agent/values.yaml

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ podSecurityContext: {}
114114
securityContext:
115115
capabilities:
116116
drop:
117-
- ALL
117+
- ALL
118118
readOnlyRootFilesystem: true
119119
runAsNonRoot: true
120120

@@ -230,28 +230,24 @@ config:
230230
# * https://kubernetes.io/docs/concepts/configuration/secret/#secret-types
231231
# * https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/#list-of-supported-fields
232232
ignoredSecretTypes:
233-
- kubernetes.io/service-account-token
234-
- kubernetes.io/dockercfg
235-
- kubernetes.io/dockerconfigjson
236-
- kubernetes.io/basic-auth
237-
- kubernetes.io/ssh-auth
238-
- bootstrap.kubernetes.io/token
239-
- helm.sh/release.v1
233+
- kubernetes.io/service-account-token
234+
- kubernetes.io/dockercfg
235+
- kubernetes.io/dockerconfigjson
236+
- kubernetes.io/basic-auth
237+
- kubernetes.io/ssh-auth
238+
- bootstrap.kubernetes.io/token
239+
- helm.sh/release.v1
240240

241241
# You can configure Venafi Kubernetes Agent to exclude some annotations or
242242
# labels from being pushed to the Venafi Control Plane. All Kubernetes objects
243243
# are affected. The objects are still pushed, but the specified annotations
244244
# and labels are removed before being sent to the Venafi Control Plane.
245245
#
246-
# If you would like to exclude annotations keys that contain the word `word`,
247-
# use the regular expression `.*word.*`. The leading and ending .* are
248-
# important if you want to filter out keys that contain `word` anywhere in the
249-
# key string.
246+
# Dots is the only character that needs to be escaped in the regex. Use either
247+
# double quotes with escaped single quotes or unquoted strings for the regex
248+
# to avoid YAML parsing issues with `\.`.
250249
#
251-
# Note that the annotation `kubectl.kubernetes.io/last-applied-configuration`
252-
# is already excluded by default, you don't need to exclude it explicitly.
253-
#
254-
# Example: excludeAnnotationKeysRegex: ["kapp\.k14s\.io\/original.*"]
250+
# Example: excludeAnnotationKeysRegex: ['^kapp\.k14s\.io/original.*']
255251
excludeAnnotationKeysRegex: []
256252
excludeLabelKeysRegex: []
257253

pkg/datagatherer/k8s/dynamic_test.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -618,16 +618,24 @@ func TestDynamicGatherer_Fetch(t *testing.T) {
618618
// username: bXl1c2VybmFtZQ==
619619
//
620620
// [1]: https://github.com/carvel-dev/kapp/issues/90#issuecomment-602074356
621-
excludeAnnotsKeys: []string{`kapp\.k14s\.io\/original.*`},
622-
623-
// We haven't found convincing examples of labels that may contain
624-
// sensitive information in the wild, so let's go with a dumb
625-
// example.
626-
excludeLabelKeys: []string{`.*sensitive.*`},
621+
//
622+
// The regular expression could be:
623+
excludeAnnotsKeys: []string{`^kapp\.k14s\.io/original.*`},
624+
625+
// A somewhat realistic example of labels that would need to be
626+
// excluded would be when a company declares ownership using
627+
// sensitive identifiers (e.g., employee IDs), and the company
628+
// doesn't want these IDs to be exposed. Let's imagine these
629+
// employee IDs look like this:
630+
//
631+
// company.com/employee-id: 12345
632+
//
633+
// The regular expression would then be:
634+
excludeLabelKeys: []string{`^company\.com/employee-id$`},
627635

628636
addObjects: []runtime.Object{getObjectAnnot("v1", "Secret", "s0", "n1",
629637
map[string]interface{}{"kapp.k14s.io/original": "foo", "kapp.k14s.io/original-diff": "bar", "normal": "true"},
630-
map[string]interface{}{"is-sensitive-label": "true", "prod": "true"},
638+
map[string]interface{}{`company.com/employee-id`: "12345", "prod": "true"},
631639
)},
632640
expected: []*api.GatheredResource{{Resource: getObjectAnnot("v1", "Secret", "s0", "n1",
633641
map[string]interface{}{"normal": "true"},

0 commit comments

Comments
 (0)