-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[super-agent-deployment] Add fleet configmap (#1221)
#### Is this a new chart No #### What this PR does / why we need it: This allows the super agent deployment to have fleet configurations. #### Special notes for your reviewer: Installability might fail because I made a breaking change on the `values.yaml` file. #### Checklist - [x] Chart Version bumped - [x] Variables are documented in the README.md - [x] Title of the PR starts with chart name (e.g. `[mychartname]`)
- Loading branch information
Showing
12 changed files
with
314 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,19 @@ | ||
cluster: sa-cluster | ||
config: | ||
content: | ||
agents: {} | ||
superAgent: | ||
content: | ||
agents: {} | ||
subAgents: | ||
test-0: | ||
content: | ||
a: test | ||
value: 0 | ||
test-1: | ||
content: | ||
a: test | ||
value: 1 | ||
test-2: | ||
content: | ||
a: test | ||
aYAML: | ||
canI: HaveSomeYAML |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
charts/super-agent-deployment/templates/configmap-subagent-configs.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{{- range $subAgentName, $subAgentConfig := .Values.config.subAgents -}} | ||
{{- $releasePrefix := include "newrelic.common.naming.fullname" $ -}} | ||
{{- $configName := printf "%s-%s" "subagent" $subAgentName -}} | ||
{{- $name := include "newrelic.common.naming.truncateToDNSWithSuffix" (dict "name" $releasePrefix "suffix" $configName) }} | ||
--- | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ $name }} | ||
namespace: {{ $.Release.Namespace }} | ||
labels: | ||
{{- include "newrelic.common.labels" $ | nindent 4 }} | ||
subagent: {{ $subAgentName }} | ||
apiVersion: v1 | ||
data: | ||
values.yml: | | ||
{{- $subAgentConfig.content | toYaml | nindent 4 }} | ||
{{- end }} |
6 changes: 3 additions & 3 deletions
6
charts/super-agent-deployment/templates/configmap-superagent-config.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{{- if .Values.config.create -}} | ||
{{- if .Values.config.superAgent.create -}} | ||
--- | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "newrelic-super-agent.config.name" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "newrelic.common.labels" $ | nindent 4 }} | ||
{{- include "newrelic.common.labels" . | nindent 4 }} | ||
apiVersion: v1 | ||
data: | ||
{{ include "newrelic-super-agent.config.key" . }}: | | ||
{{ include "newrelic-super-agent.config.key" . }}: | | ||
{{- include "newrelic-super-agent.config.content" . | nindent 4 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
charts/super-agent-deployment/tests/configmap_fleet_configs_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
suite: subagent configurations | ||
templates: | ||
- templates/configmap-subagent-configs.yaml | ||
release: | ||
name: my-release | ||
namespace: my-namespace | ||
tests: | ||
- it: does not template nothing by default | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: super agent's config template correctly | ||
set: | ||
config: | ||
subAgents: | ||
test-0: | ||
content: | ||
a: test | ||
value: 0 | ||
test-1: | ||
content: | ||
a: test | ||
value: 1 | ||
test-2: | ||
content: | ||
a: test | ||
aYAML: | ||
canI: HaveSomeYAML | ||
asserts: | ||
- hasDocuments: | ||
count: 3 | ||
|
||
- documentIndex: 0 | ||
equal: | ||
path: metadata.name | ||
value: my-release-super-agent-deployment-subagent-test-0 | ||
- documentIndex: 0 | ||
equal: | ||
path: data["values.yml"] | ||
value: | | ||
a: test | ||
value: 0 | ||
- documentIndex: 1 | ||
equal: | ||
path: metadata.name | ||
value: my-release-super-agent-deployment-subagent-test-1 | ||
- documentIndex: 1 | ||
equal: | ||
path: data["values.yml"] | ||
value: | | ||
a: test | ||
value: 1 | ||
- documentIndex: 2 | ||
equal: | ||
path: metadata.name | ||
value: my-release-super-agent-deployment-subagent-test-2 | ||
- documentIndex: 2 | ||
equal: | ||
path: data["values.yml"] | ||
value: | | ||
a: test | ||
aYAML: | ||
canI: HaveSomeYAML |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...eployment/tests/securityContext_test.yaml → ...ment_superagent_securityContext_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
charts/super-agent-deployment/tests/deployment_superagent_subagent_configs_test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
suite: test super agent deployment's subagent configurations | ||
templates: | ||
- templates/deployment-superagent.yaml | ||
- templates/configmap-superagent-config.yaml | ||
- templates/configmap-subagent-configs.yaml | ||
release: | ||
name: my-release | ||
namespace: my-namespace | ||
tests: | ||
|
||
- it: there are no subagent configurations by default | ||
set: | ||
cluster: test | ||
asserts: | ||
- template: templates/deployment-superagent.yaml | ||
equal: | ||
path: spec.template.spec.containers[0].volumeMounts | ||
value: | ||
- name: super-agent-config | ||
mountPath: /etc/newrelic-super-agent | ||
readOnly: true | ||
- mountPath: /var/lib/newrelic-super-agent | ||
name: var-lib-newrelic-super-agent | ||
readOnly: false | ||
- template: templates/deployment-superagent.yaml | ||
equal: | ||
path: spec.template.spec.volumes | ||
value: | ||
- name: super-agent-config | ||
configMap: | ||
name: my-release-super-agent-deployment-superagent-config | ||
items: | ||
- key: config.yaml | ||
path: config.yaml | ||
- name: var-lib-newrelic-super-agent | ||
emptyDir: {} | ||
|
||
- it: subagent configurations template file mounts | ||
set: | ||
cluster: test | ||
config: | ||
subAgents: | ||
test-0: | ||
content: | ||
a: test | ||
value: 0 | ||
test-1: | ||
content: | ||
a: test | ||
value: 1 | ||
test-2: | ||
content: | ||
a: test | ||
aYAML: | ||
canI: HaveSomeYAML | ||
asserts: | ||
- template: templates/deployment-superagent.yaml | ||
equal: | ||
path: spec.template.spec.containers[0].volumeMounts | ||
value: | ||
- name: super-agent-config | ||
mountPath: /etc/newrelic-super-agent | ||
readOnly: true | ||
- name: subagent-configmap-my-release-super-agent-deployment-subagent-test-0 | ||
mountPath: /etc/newrelic-super-agent/fleet/agents.d/test-0 | ||
readOnly: true | ||
- name: subagent-configmap-my-release-super-agent-deployment-subagent-test-1 | ||
mountPath: /etc/newrelic-super-agent/fleet/agents.d/test-1 | ||
readOnly: true | ||
- name: subagent-configmap-my-release-super-agent-deployment-subagent-test-2 | ||
mountPath: /etc/newrelic-super-agent/fleet/agents.d/test-2 | ||
readOnly: true | ||
- mountPath: /var/lib/newrelic-super-agent | ||
name: var-lib-newrelic-super-agent | ||
readOnly: false | ||
- template: templates/deployment-superagent.yaml | ||
equal: | ||
path: spec.template.spec.volumes | ||
value: | ||
- name: super-agent-config | ||
configMap: | ||
name: my-release-super-agent-deployment-superagent-config | ||
items: | ||
- key: config.yaml | ||
path: config.yaml | ||
- name: subagent-configmap-my-release-super-agent-deployment-subagent-test-0 | ||
configMap: | ||
name: my-release-super-agent-deployment-subagent-test-0 | ||
- name: subagent-configmap-my-release-super-agent-deployment-subagent-test-1 | ||
configMap: | ||
name: my-release-super-agent-deployment-subagent-test-1 | ||
- name: subagent-configmap-my-release-super-agent-deployment-subagent-test-2 | ||
configMap: | ||
name: my-release-super-agent-deployment-subagent-test-2 | ||
- name: var-lib-newrelic-super-agent | ||
emptyDir: {} | ||
|
||
|
||
|
Oops, something went wrong.