diff --git a/deploy/charts/cyberark-disco-agent/README.md b/deploy/charts/cyberark-disco-agent/README.md index 79e7e19a..4ab94357 100644 --- a/deploy/charts/cyberark-disco-agent/README.md +++ b/deploy/charts/cyberark-disco-agent/README.md @@ -257,10 +257,10 @@ Configure a PodDisruptionBudget for the agent's Deployment. If running with mult #### **config.period** ~ `string` > Default value: > ```yaml -> 1h0m0s +> 12h0m0s > ``` -Push data every hour unless changed. +Push data every 12 hours unless changed. #### **config.excludeAnnotationKeysRegex** ~ `array` > Default value: > ```yaml diff --git a/deploy/charts/cyberark-disco-agent/tests/README.md b/deploy/charts/cyberark-disco-agent/tests/README.md new file mode 100644 index 00000000..0416d603 --- /dev/null +++ b/deploy/charts/cyberark-disco-agent/tests/README.md @@ -0,0 +1,9 @@ +# `helm unittest` + +We use `helm unittest` to test the YAML output coming out of the Helm chart. + +In order to update the snapshots, run the following command: + +```bash +make test-helm-snapshot +``` diff --git a/deploy/charts/cyberark-disco-agent/tests/__snapshot__/configmap_test.yaml.snap b/deploy/charts/cyberark-disco-agent/tests/__snapshot__/configmap_test.yaml.snap new file mode 100644 index 00000000..0e2ca62b --- /dev/null +++ b/deploy/charts/cyberark-disco-agent/tests/__snapshot__/configmap_test.yaml.snap @@ -0,0 +1,210 @@ +custom-period: + 1: | + apiVersion: v1 + data: + config.yaml: |- + period: "1m" + data-gatherers: + - kind: k8s-discovery + name: ark/discovery + - kind: k8s-dynamic + name: ark/secrets + config: + resource-type: + version: v1 + resource: secrets + field-selectors: + - type!=kubernetes.io/dockercfg + - type!=kubernetes.io/dockerconfigjson + - type!=bootstrap.kubernetes.io/token + - type!=helm.sh/release.v1 + - kind: k8s-dynamic + name: ark/serviceaccounts + config: + resource-type: + resource: serviceaccounts + version: v1 + - kind: k8s-dynamic + name: ark/roles + config: + resource-type: + version: v1 + group: rbac.authorization.k8s.io + resource: roles + - kind: k8s-dynamic + name: ark/clusterroles + config: + resource-type: + version: v1 + group: rbac.authorization.k8s.io + resource: clusterroles + - kind: k8s-dynamic + name: ark/rolebindings + config: + resource-type: + version: v1 + group: rbac.authorization.k8s.io + resource: rolebindings + - kind: k8s-dynamic + name: ark/clusterrolebindings + config: + resource-type: + version: v1 + group: rbac.authorization.k8s.io + resource: clusterrolebindings + - kind: k8s-dynamic + name: ark/jobs + config: + resource-type: + version: v1 + group: batch + resource: jobs + - kind: k8s-dynamic + name: ark/cronjobs + config: + resource-type: + version: v1 + group: batch + resource: cronjobs + - kind: k8s-dynamic + name: ark/deployments + config: + resource-type: + version: v1 + group: apps + resource: deployments + - kind: k8s-dynamic + name: ark/statefulsets + config: + resource-type: + version: v1 + group: apps + resource: statefulsets + - kind: k8s-dynamic + name: ark/daemonsets + config: + resource-type: + version: v1 + group: apps + resource: daemonsets + - kind: k8s-dynamic + name: ark/pods + config: + resource-type: + version: v1 + resource: pods + kind: ConfigMap + metadata: + labels: + app.kubernetes.io/instance: test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: cyberark-disco-agent + app.kubernetes.io/version: v0.0.0 + helm.sh/chart: cyberark-disco-agent-0.0.0 + name: test-cyberark-disco-agent-config + namespace: test-ns +defaults: + 1: | + apiVersion: v1 + data: + config.yaml: |- + period: "12h0m0s" + data-gatherers: + - kind: k8s-discovery + name: ark/discovery + - kind: k8s-dynamic + name: ark/secrets + config: + resource-type: + version: v1 + resource: secrets + field-selectors: + - type!=kubernetes.io/dockercfg + - type!=kubernetes.io/dockerconfigjson + - type!=bootstrap.kubernetes.io/token + - type!=helm.sh/release.v1 + - kind: k8s-dynamic + name: ark/serviceaccounts + config: + resource-type: + resource: serviceaccounts + version: v1 + - kind: k8s-dynamic + name: ark/roles + config: + resource-type: + version: v1 + group: rbac.authorization.k8s.io + resource: roles + - kind: k8s-dynamic + name: ark/clusterroles + config: + resource-type: + version: v1 + group: rbac.authorization.k8s.io + resource: clusterroles + - kind: k8s-dynamic + name: ark/rolebindings + config: + resource-type: + version: v1 + group: rbac.authorization.k8s.io + resource: rolebindings + - kind: k8s-dynamic + name: ark/clusterrolebindings + config: + resource-type: + version: v1 + group: rbac.authorization.k8s.io + resource: clusterrolebindings + - kind: k8s-dynamic + name: ark/jobs + config: + resource-type: + version: v1 + group: batch + resource: jobs + - kind: k8s-dynamic + name: ark/cronjobs + config: + resource-type: + version: v1 + group: batch + resource: cronjobs + - kind: k8s-dynamic + name: ark/deployments + config: + resource-type: + version: v1 + group: apps + resource: deployments + - kind: k8s-dynamic + name: ark/statefulsets + config: + resource-type: + version: v1 + group: apps + resource: statefulsets + - kind: k8s-dynamic + name: ark/daemonsets + config: + resource-type: + version: v1 + group: apps + resource: daemonsets + - kind: k8s-dynamic + name: ark/pods + config: + resource-type: + version: v1 + resource: pods + kind: ConfigMap + metadata: + labels: + app.kubernetes.io/instance: test + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/name: cyberark-disco-agent + app.kubernetes.io/version: v0.0.0 + helm.sh/chart: cyberark-disco-agent-0.0.0 + name: test-cyberark-disco-agent-config + namespace: test-ns diff --git a/deploy/charts/cyberark-disco-agent/tests/configmap_test.yaml b/deploy/charts/cyberark-disco-agent/tests/configmap_test.yaml new file mode 100644 index 00000000..845ae292 --- /dev/null +++ b/deploy/charts/cyberark-disco-agent/tests/configmap_test.yaml @@ -0,0 +1,16 @@ +suite: test the contents of the config.yaml +templates: + - configmap.yaml +release: + name: test + namespace: test-ns +tests: + - it: defaults + asserts: + - matchSnapshot: {} + + - it: custom-period + set: + config.period: 1m + asserts: + - matchSnapshot: {} diff --git a/deploy/charts/cyberark-disco-agent/values.schema.json b/deploy/charts/cyberark-disco-agent/values.schema.json index 93bd388e..62f20129 100644 --- a/deploy/charts/cyberark-disco-agent/values.schema.json +++ b/deploy/charts/cyberark-disco-agent/values.schema.json @@ -128,8 +128,8 @@ "type": "array" }, "helm-values.config.period": { - "default": "1h0m0s", - "description": "Push data every hour unless changed.", + "default": "12h0m0s", + "description": "Push data every 12 hours unless changed.", "type": "string" }, "helm-values.extraArgs": { diff --git a/deploy/charts/cyberark-disco-agent/values.yaml b/deploy/charts/cyberark-disco-agent/values.yaml index 79b7a670..bb700756 100644 --- a/deploy/charts/cyberark-disco-agent/values.yaml +++ b/deploy/charts/cyberark-disco-agent/values.yaml @@ -122,8 +122,8 @@ podDisruptionBudget: # Configuration for the agent config: - # Push data every hour unless changed. - period: "1h0m0s" + # Push data every 12 hours unless changed. + period: "12h0m0s" # You can configure the agent to exclude some annotations or # labels from being pushed . All Kubernetes objects diff --git a/make/02_mod.mk b/make/02_mod.mk index 25bf1602..f56a89d3 100644 --- a/make/02_mod.mk +++ b/make/02_mod.mk @@ -58,13 +58,13 @@ test-e2e-gke: | $(NEEDS_HELM) $(NEEDS_STEP) $(NEEDS_VENCTL) ## Run `helm unittest`. ## @category Testing test-helm: | $(NEEDS_HELM-UNITTEST) - $(HELM-UNITTEST) ./deploy/charts/venafi-kubernetes-agent/ + $(HELM-UNITTEST) ./deploy/charts/{venafi-kubernetes-agent,cyberark-disco-agent} .PHONY: test-helm-snapshot ## Update the `helm unittest` snapshots. ## @category Testing test-helm-snapshot: | $(NEEDS_HELM-UNITTEST) - $(HELM-UNITTEST) ./deploy/charts/venafi-kubernetes-agent/ -u + $(HELM-UNITTEST) ./deploy/charts/{venafi-kubernetes-agent,cyberark-disco-agent} -u .PHONY: helm-plugins ## Install required helm plugins diff --git a/make/ark/02_mod.mk b/make/ark/02_mod.mk index 62cb9314..5b89172c 100644 --- a/make/ark/02_mod.mk +++ b/make/ark/02_mod.mk @@ -1,19 +1,3 @@ -.PHONY: ark-generate-helm-docs -## Generate Helm chart documentation. -## @category CyberArk Discovery and Context -ark-generate-helm-docs: helm_chart_source_dir := deploy/charts/cyberark-disco-agent -ark-generate-helm-docs: generate-helm-docs - -shared_generate_targets += ark-generate-helm-docs - -.PHONY: ark-generate-helm-schema -## Generate Helm chart schema. -## @category CyberArk Discovery and Context -ark-generate-helm-schema: helm_chart_source_dir := deploy/charts/cyberark-disco-agent -ark-generate-helm-schema: generate-helm-schema - -shared_generate_targets += ark-generate-helm-schema - GITHUB_OUTPUT ?= /dev/stderr .PHONY: ark-release ## Publish all release artifacts (image + helm chart) @@ -61,3 +45,13 @@ ark-verify: helm_chart_image_name=$(OCI_BASE)/charts/cyberark-disco-agent shared_verify_targets_dirty += ark-verify + +.PHONY: ark-generate +## Generate Helm chart documentation and schema +## @category CyberArk Discovery and Context +ark-generate: + $(MAKE) generate-helm-docs generate-helm-schema \ + helm_chart_source_dir=deploy/charts/cyberark-disco-agent + +shared_generate_targets += ark-generate +