Skip to content

Commit

Permalink
changed toggle to disabled opamp to opamp instead of auth
Browse files Browse the repository at this point in the history
  • Loading branch information
kang-makes committed Sep 17, 2024
1 parent 5d0d42e commit bb350a8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
2 changes: 1 addition & 1 deletion charts/super-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ As of the creation of the chart, it has no particularities and this section can
| super-agent-deployment.affinity | object | `{}` | Sets pod/node affinities. Can be configured also with `global.affinity` |
| super-agent-deployment.cleanupManagedResources | bool | `true` | Enable the cleanup of super-agent managed resources when the chart is uninstalled. If disabled, agents and/or agent configurations managed by the super-agent will not be deleted when the chart is uninstalled. |
| super-agent-deployment.cluster | string | `""` | Name of the Kubernetes cluster monitored. Can be configured also with `global.cluster`. |
| super-agent-deployment.config.auth.enabled | bool | `true` | Enables or disables the auth against fleet control. It implies to disable any fleet communication and running the agent in stand alone mode where only the agents specified on `.config.subAgents` will be launched. |
| super-agent-deployment.config.auth.organization_id | string | `""` | Organization ID where fleets will live. |
| super-agent-deployment.config.auth.secret.client_id.base64 | string | `nil` | In case `.config.auth.secret.create` is true, you can set these keys to set client ID directly as base64. This options is mutually exclusive with `plain`. |
| super-agent-deployment.config.auth.secret.client_id.plain | string | `nil` | In case `.config.auth.secret.create` is true, you can set these keys to set client ID directly as plain text. This options is mutually exclusive with `base64`. |
Expand All @@ -60,6 +59,7 @@ As of the creation of the chart, it has no particularities and this section can
| super-agent-deployment.config.auth.secret.private_key.base64_pem | string | `nil` | In case `.config.auth.secret.create` is true, you can set these keys to set private key directly as base64. This options is mutually exclusive with `plain_pem`. |
| super-agent-deployment.config.auth.secret.private_key.plain_pem | string | `nil` | In case `.config.auth.secret.create` is true, you can set these keys to set private key directly as plain text. This options is mutually exclusive with `base64_pem`. |
| super-agent-deployment.config.auth.secret.private_key.secret_key | string | `private_key` | Key inside the secret containing the private key. |
| super-agent-deployment.config.opamp.enabled | bool | `true` | Enables or disables the auth against fleet control. It implies to disable any fleet communication and running the agent in stand alone mode where only the agents specified on `.config.subAgents` will be launched. |
| super-agent-deployment.config.subAgents | string | {} (Empty. That defaults to configure the `newrelic/io.opentelemetry.collector` subagent) | Values that the fleet is going to have in the deployment. |
| super-agent-deployment.config.superAgent | object | See `values.yaml` | Configuration for the Super Agent. |
| super-agent-deployment.config.superAgent.content | object | `{}` | It you are a PowerUser, you can use this to override the configuration that has been created automatically by the chart. This configuration here will be **MERGED** with the configuration specified above. If you need to have you own configuration, disabled the creation of this configMap and create your own. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ If you need a list of TODOs, just `grep TODO` on the `values.yaml` and look for
{{- $k8s := (dict "cluster_name" (include "newrelic.common.cluster" .) "namespace" .Release.Namespace) -}}
{{- $config = mustMerge $config (dict "k8s" $k8s) -}}

{{- /* Add opamp if auth enabled */ -}}
{{- if ((.Values.config).auth).enabled -}}
{{- /* Add opamp if enabled */ -}}
{{- if ((.Values.config).opamp).enabled -}}
{{- $opamp := (dict "endpoint" (include "newrelic-super-agent.config.endpoints.opamp" .)) -}}

{{- $auth_config := dict "token_url" (include "newrelic-super-agent.config.endpoints.tokenRenewal" .) "provider" "local" "private_key_path" "/etc/newrelic-super-agent/keys/from-secret.key" -}}
Expand Down Expand Up @@ -205,7 +205,7 @@ Helper to toggle the creation of the job that creates and registers the system i
{{- $privateKey := include "newrelic-super-agent.auth.secret.privateKey.data" . -}}
{{- $clientId := include "newrelic-super-agent.auth.secret.clientId.data" . -}}
{{- if and ((.Values.config).auth).enabled (((.Values.config).auth).secret).create (not $privateKey) (not $clientId) -}}
{{- if and ((.Values.config).opamp).enabled (((.Values.config).auth).secret).create (not $privateKey) (not $clientId) -}}
true
{{- end -}}
{{- end -}}
Expand All @@ -216,7 +216,7 @@ Helper to toggle the creation of the job that creates and registers the system i
Helper to toggle the creation of the secret that has the system identity as values.
*/ -}}
{{- define "newrelic-super-agent.auth.secret.shouldTemplate" -}}
{{- if and ((.Values.config).auth).enabled (((.Values.config).auth).secret).create -}}
{{- if and ((.Values.config).opamp).enabled (((.Values.config).auth).secret).create -}}
{{- $privateKey := include "newrelic-super-agent.auth.secret.privateKey.data" . -}}
{{- $clientId := include "newrelic-super-agent.auth.secret.clientId.data" . -}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ spec:
imagePullPolicy: {{ .Values.image.pullPolicy }}

env:
{{- if ((.Values.config).auth).enabled }}
{{- if ((.Values.config).opamp).enabled }}
- name: NR_SA_OPAMP__AUTH_CONFIG__CLIENT_ID
valueFrom:
secretKeyRef:
Expand Down Expand Up @@ -115,7 +115,7 @@ spec:
- mountPath: /var/lib/newrelic-super-agent
name: var-lib-newrelic-super-agent
readOnly: false
{{- if ((.Values.config).auth).enabled }}
{{- if ((.Values.config).opamp).enabled }}
- name: auth-secret-private-key
mountPath: "/etc/newrelic-super-agent/keys/from-secret.key"
subPath: {{ include "newrelic-super-agent.auth.secret.privateKey.key" . }}
Expand All @@ -136,7 +136,7 @@ spec:
path: config.yaml
- name: var-lib-newrelic-super-agent
emptyDir: {}
{{- if ((.Values.config).auth).enabled }}
{{- if ((.Values.config).opamp).enabled }}
- name: auth-secret-private-key
secret:
secretName: {{ include "newrelic-super-agent.auth.secret.name" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@ tests:
asserts:
- hasDocuments:
count: 0

- it: opamp can be disabled
set:
cluster: my-cluster
config:
opamp:
enabled: false
asserts:
- equal:
path: data["local_config"]
value: |
agents:
open-telemetry:
agent_type: newrelic/io.opentelemetry.collector:0.2.0
k8s:
cluster_name: my-cluster
namespace: my-namespace
server:
enabled: true
- it: super agent's config always include cluster_name, namespace and defaults
set:
cluster: my-cluster
Expand All @@ -36,6 +56,7 @@ tests:
endpoint: https://opamp.service.newrelic.com/v1/opamp
server:
enabled: true
- it: super agent's config templates
set:
cluster: my-cluster
Expand Down Expand Up @@ -64,6 +85,7 @@ tests:
enabled: true
test: value
test2: value2
- it: cluster_name and namespace from config have precedence
set:
cluster: my-cluster
Expand Down Expand Up @@ -95,6 +117,7 @@ tests:
enabled: true
test: value
test2: value2
- it: super agent's config always include cluster_name, namespace, defaults, and honor the EU endpoint.
set:
cluster: my-cluster
Expand Down
4 changes: 3 additions & 1 deletion charts/super-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,12 @@ super-agent-deployment:
# chart_values:
# # you can set here modifications to the open telemetry chart

auth:
opamp:
# -- Enables or disables the auth against fleet control. It implies to disable any fleet communication and running the agent
# in stand alone mode where only the agents specified on `.config.subAgents` will be launched.
enabled: true

auth:
# -- Organization ID where fleets will live.
organization_id: ""
secret:
Expand Down

0 comments on commit bb350a8

Please sign in to comment.