Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the extra whitespace around the supplied (or ommitted) exclude regexes #622

Merged
merged 1 commit into from
Nov 19, 2024

Conversation

wallrj
Copy link
Member

@wallrj wallrj commented Nov 15, 2024

Before:

$ helm template deploy/charts/venafi-kubernetes-agent   --show-only templates/configmap.yaml | yq '.data."config.yaml"' | head
cluster_id: ""
cluster_description: ""
server: "https://api.venafi.cloud/"
period: "0h1m0s"
exclude-annotation-keys-regex:

  []
exclude-label-keys-regex:

  []

$ helm template deploy/charts/venafi-kubernetes-agent   --show-only templates/configmap.yaml --set config.excludeAnnotationKeysRegex={'.*'}   --set config.excludeLabelKeysRegex={'.*'} | yq '.data."conf
ig.yaml"' | head
cluster_id: ""
cluster_description: ""
server: "https://api.venafi.cloud/"
period: "0h1m0s"
exclude-annotation-keys-regex:

  - .*
exclude-label-keys-regex:

  - .*

After:

$ helm template deploy/charts/venafi-kubernetes-agent   --show-only templates/configmap.yaml  | yq '.data."config.yaml"' | head
cluster_id: ""
cluster_description: ""
server: "https://api.venafi.cloud/"
period: "0h1m0s"
venafi-cloud:
  uploader_id: "no"
  upload_path: "/v1/tlspk/upload/clusterdata"
data-gatherers:
# gather k8s apiserver version information
- kind: "k8s-discovery"

$ helm template deploy/charts/venafi-kubernetes-agent   --show-only templates/configmap.yaml  --set config.excludeAnnotationKeysRegex={'.*'}   --set config.excludeLabelKeysRegex={'.*'} | yq '.data."config.yaml"' | head
cluster_id: ""
cluster_description: ""
server: "https://api.venafi.cloud/"
period: "0h1m0s"
exclude-annotation-keys-regex:
  - .*
exclude-label-keys-regex:
  - .*
venafi-cloud:
  uploader_id: "no"

Testing

I ran the e2e test and it succeeded:

$ make test-e2e-gke
...
{
  "ts": 1731686855541.627,
  "caller": "agent/run.go:224",
  "msg": "Failed to complete initial sync of DataGatherer",
  "logger": "Run",
  "kind": "k8s-dynamic",
  "name": "k8s/fireflyissuers",
  "err": "timed out waiting for Kubernetes caches to sync"
}
{"ts":1731686856218.3735,"caller":"agent/run.go:409","msg":"Data sent successfully","v":0,"logger":"Run.gatherAndOutputData.postData"}

Then I got the resulting configmap and saw that it contained the new supplied annotation exclusion, but that the excludeLabel field was omitted, as expected, which did not cause any problems:

$ kubectl get cm -n venafi agent-config  -o yaml  | yq '.data."config.yaml"'  | head
cluster_id: "venafi-kubernetes-agent-e2e"
cluster_description: "A kind cluster used for testing the venafi-kubernetes-agent.\n"
server: "https://api.venafi.eu/"
period: "0h1m0s"
exclude-annotation-keys-regex:
  - ^kapp\.k14s\.io/original.*
venafi-cloud:
  uploader_id: "no"
  upload_path: "/v1/tlspk/upload/clusterdata"
data-gatherers:

… regexes

Signed-off-by: Richard Wall <richard.wall@venafi.com>
Copy link
Member

@maelvls maelvls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the thorough testing, as well as the well-written description! I haven't tested the changes myself. I am confident that nothing will break, though, thanks to your extensive testing.

@wallrj wallrj merged commit f644b84 into master Nov 19, 2024
2 checks passed
@wallrj wallrj deleted the fix-config-whitespace branch November 19, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants