Skip to content

Commit

Permalink
[newrelic-logging] Rename customSecretKey to customSecretLicenseKey (n…
Browse files Browse the repository at this point in the history
…ewrelic#60)

* Rename customSecretKey to customSecretLicenseKey

The other New Relic charts like newrelic-infrastructure and
nri-prometheus use the name `customSecretLicenseKey`.

With these changes we are adding support for both options so that we
don't break users that are already using the old name. To encourage
usage we remove the old name and change it for the new one.

* [newrelic-logging] add nrStaging variable to send metrics to staging
  • Loading branch information
alejandrodnm authored Jun 10, 2020
1 parent 733392e commit a293313
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 deletions.
2 changes: 1 addition & 1 deletion charts/newrelic-logging/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: A Helm chart to deploy New Relic Kubernetes Logging as a DaemonSet
name: newrelic-logging
version: 1.0.5
version: 1.1.0
appVersion: 1.3.0
home: https://github.com/newrelic/kubernetes-logging
icon: https://newrelic.com/assets/newrelic/source/NewRelic-logo-square.svg
Expand Down
3 changes: 2 additions & 1 deletion charts/newrelic-logging/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ See [values.yaml](values.yaml) for the default values
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
| `global.licenseKey` - `licenseKey` | The [license key](https://docs.newrelic.com/docs/accounts/install-new-relic/account-setup/license-key) for your New Relic Account. This will be the preferred configuration option if both `licenseKey` and `customSecret*` values are specified. | |
| `global.customSecretName` - `customSecretName` | Name of the Secret object where the license key is stored | |
| `global.customSecretKey` - `customSecretKey` | Key in the Secret object where the license key is stored. | |
| `global.customSecretLicenseKey` - `customSecretLicenseKey` | Key in the Secret object where the license key is stored. | |
| `rbac.create` | Enable Role-based authentication | `true` |
| `image.repository` | The container to pull. | `newrelic/newrelic-fluentbit-output` |
| `image.pullPolicy` | The pull policy. | `IfNotPresent` |
Expand All @@ -24,6 +24,7 @@ See [values.yaml](values.yaml) for the default values
| `updateStrategy` | Strategy for DaemonSet updates (requires Kubernetes >= 1.6) | `RollingUpdate` |
| `serviveAccount.create` | If true, a service account would be created and assigned to the deployment | true |
| `serviveAccount.name` | The service account to assign to the deployment. If `serviveAccount.create` is true then this name will be used when creating the service account | |
| `global.nrStaging` - `nrStaging` | Send data to staging (requires a staging license key) | false |

## Example

Expand Down
25 changes: 20 additions & 5 deletions charts/newrelic-logging/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,35 @@ Return the customSecretName
{{- end -}}

{{/*
Return the customSecretKey
Return the customSecretLicenseKey
*/}}
{{- define "newrelic-logging.customSecretKey" -}}
{{- if .Values.global }}
{{- if .Values.global.customSecretKey }}
{{- .Values.global.customSecretKey -}}
{{- if .Values.global.customSecretLicenseKey }}
{{- .Values.global.customSecretLicenseKey -}}
{{- else -}}
{{- .Values.customSecretKey | default "" -}}
{{- if .Values.global.customSecretKey }}
{{- .Values.global.customSecretKey -}}
{{- else -}}
{{- .Values.customSecretKey | default "" -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- .Values.customSecretKey | default "" -}}
{{- if .Values.customSecretLicenseKey }}
{{- .Values.customSecretLicenseKey -}}
{{- else -}}
{{- .Values.customSecretKey | default "" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Returns nrStaging
*/}}
{{- define "newrelic.nrStaging" -}}
{{- or .Values.global.nrStaging .Values.nrStaging }}
{{- end -}}

{{/*
Returns if the template should render, it checks if the required values are set.
*/}}
Expand Down
4 changes: 3 additions & 1 deletion charts/newrelic-logging/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ spec:
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
env:
- name: ENDPOINT
{{- if .Values.endpoint }}
{{- if eq (include "newrelic.nrStaging" .) "true" }}
value: "https://staging-log-api.newrelic.com/log/v1"
{{- else if .Values.endpoint }}
value: {{ .Values.endpoint }}
{{- else if eq (substr 0 2 (include "newrelic-logging.licenseKey" .)) "eu" }}
value: "https://log-api.eu.newrelic.com/log/v1"
Expand Down
8 changes: 6 additions & 2 deletions charts/newrelic-logging/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# or Specify secret which contains New Relic API key
# customSecretName: secret_name
# customSecretKey: secret_key
# customSecretLicenseKey: secret_key
#
# The previous values can also be set as global so that they
# can be shared by other newrelic product's charts
Expand All @@ -12,7 +12,7 @@
# licenseKey:
# clusterName:
# customSecretName:
# customSecretKey:
# customSecretLicenseKey:
#
# IMPORTANT: if you use a kubernetes secret to specify the license,
# you have to manually provide the correct endpoint depending on
Expand Down Expand Up @@ -71,3 +71,7 @@ tolerations:
effect: "NoExecute"

updateStrategy: RollingUpdate

# Sends data to staging, can be set as a global.
# global.nrStaging
nrStaging: false

0 comments on commit a293313

Please sign in to comment.