Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deploy/charts/discovery-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ The Discovery Agent connects your Kubernetes or OpenShift cluster to Palo Alto N

<!-- AUTO-GENERATED -->

#### **config.tsgID** ~ `string,number`
#### **config.tsgID** ~ `string`
> Default value:
> ```yaml
> ""
> ```

Required: The TSG (Tenant Service Group) ID to use when connecting to SCM. NB: TSG IDs are numeric, but should be treated as strings. If being set with the Helm CLI prefer `--set-string`.
Required: The TSG (Tenant Service Group) ID to use when connecting to SCM. NB: TSG IDs are numeric, but must be treated as strings to avoid issues with YAML data types. With the Helm CLI use `--set-string`; with YAML always pass TSG IDs in double quotes.


#### **config.clusterName** ~ `string`
Expand Down
4 changes: 2 additions & 2 deletions deploy/charts/discovery-agent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ spec:
- --ngts-server-url
- {{ . | quote }}
{{- end }}
{{- if .Values.config.clientID }}
{{- if or .Values.config.clientID .Values.config.clientId }}
- --client-id
- {{ .Values.config.clientID }}
- {{ .Values.config.clientID | default .Values.config.clientId }}
{{- end }}
- --private-key-path
- /etc/discovery-agent/credentials/privatekey.pem
Expand Down
91 changes: 91 additions & 0 deletions deploy/charts/discovery-agent/tests/configmap_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
suite: test configmap
templates:
- configmap.yaml

tests:
# Test basic ConfigMap rendering
- it: should create ConfigMap with required values
set:
config.clusterName: my-test-cluster
config.tsgID: "123456"
asserts:
- isKind:
of: ConfigMap
- equal:
path: metadata.name
value: RELEASE-NAME-discovery-agent-config
- matchRegex:
path: data["config.yaml"]
pattern: 'cluster_name: "my-test-cluster"'

# Test cluster description
- it: should include cluster description when set
set:
config.clusterName: test-cluster
config.tsgID: "123456"
config.clusterDescription: "This is a test cluster"
asserts:
- matchRegex:
path: data["config.yaml"]
pattern: 'cluster_description: "This is a test cluster"'

# Test period configuration
- it: should set custom period
set:
config.clusterName: test-cluster
config.tsgID: "123456"
config.period: "0h5m0s"
asserts:
- matchRegex:
path: data["config.yaml"]
pattern: 'period: "0h5m0s"'

# Test exclude annotation keys regex
- it: should include excludeAnnotationKeysRegex when set
set:
config.clusterName: test-cluster
config.tsgID: "123456"
config.excludeAnnotationKeysRegex:
- "^kapp\\.k14s\\.io/original.*"
- "^kubectl\\.kubernetes\\.io/.*"
asserts:
- matchRegex:
path: data["config.yaml"]
pattern: 'exclude-annotation-keys-regex:'
- matchRegex:
path: data["config.yaml"]
pattern: '\^kapp\\\.k14s\\\.io/original\.\*'

# Test exclude label keys regex
- it: should include excludeLabelKeysRegex when set
set:
config.clusterName: test-cluster
config.tsgID: "123456"
config.excludeLabelKeysRegex:
- "^helm\\.sh/.*"
asserts:
- matchRegex:
path: data["config.yaml"]
pattern: 'exclude-label-keys-regex:'
- matchRegex:
path: data["config.yaml"]
pattern: '\^helm\\\.sh/\.\*'

# Test data-gatherers are present
- it: should include all data-gatherers
set:
config.clusterName: test-cluster
config.tsgID: "123456"
asserts:
- matchRegex:
path: data["config.yaml"]
pattern: 'kind: k8s-discovery'
- matchRegex:
path: data["config.yaml"]
pattern: 'name: k8s/secrets'
- matchRegex:
path: data["config.yaml"]
pattern: 'name: k8s/jobs'
- matchRegex:
path: data["config.yaml"]
pattern: 'name: k8s/deployments'
Loading
Loading