common-library

by Helm

Helm chartv2.3.5

Provides helpers to provide consistency on all the charts

About this chart

Helm Common library

The common library is a way to unify the UX through all the Helm charts that implement it.

The tooling suite that New Relic is huge and growing and this allows to set things globally and locally for a single chart.

Documentation for chart writers

If you are writing a chart that is going to use this library you can check the developers guide to see all the functions/templates that we have implemented, what they do and how to use them.

Values managed globally

We want to have a seamless experience through all the charts so we created this library that tries to standardize the behaviour of all the charts. Sadly, because of the complexity of all these integrations, not all the charts behave exactly as expected.

An example is newrelic-infrastructure that ignores hostNetwork in the control plane scraper because most of the users has the control plane listening in the node to localhost.

For each chart that has a special behavior (or further information of the behavior) there is a "chart particularities" section in its README.md that explains which is the expected behavior.

At the time of writing this, all the charts from nri-bundle except newrelic-logging and synthetics-minion implements this library and honors global options as described in this document.

Here is a list of global options:

Global keysLocal keysDefaultMerged1Description
global.clustercluster""Name of the Kubernetes cluster monitored
global.licenseKeylicenseKey""This set this license key to use
global.customSecretNamecustomSecretName""In case you don't want to have the license key in you values, this allows you to point to a user created secret to get the key from there
global.customSecretLicenseKeycustomSecretLicenseKey""In case you don't want to have the license key in you values, this allows you to point to which secret key is the license key located
global.podLabelspodLabels{}yesAdditional labels for chart pods
global.labelslabels{}yesAdditional labels for chart objects
global.priorityClassNamepriorityClassName""Sets pod's priorityClassName
global.hostNetworkhostNetworkfalseSets pod's hostNetwork
global.dnsConfigdnsConfig{}Sets pod's dnsConfig
global.images.registrySee Further information"docker.io"Changes the registry where to get the images. Useful when there is an internal image cache/proxy. Defaults to docker.io when not specified
global.images.pullSecretsSee Further information[]yesSet secrets to be able to fetch images
global.podSecurityContextpodSecurityContext{}Sets security context (at pod level)
global.containerSecurityContextcontainerSecurityContext{}Sets security context (at container level)
global.affinityaffinity{}Sets pod/node affinities
global.nodeSelectornodeSelector{}Sets pod's node selector
global.tolerationstolerations[]Sets pod's tolerations to node taints
global.serviceAccount.createserviceAccount.createtrueConfigures if the service account should be created or not
global.serviceAccount.nameserviceAccount.namename of the releaseChange the name of the service account. This is honored if you disable on this cahrt the creation of the service account so you can use your own.
global.serviceAccount.annotationsserviceAccount.annotations{}yesAdd these annotations to the service account we create
global.customAttributescustomAttributes{}Adds extra attributes to the cluster and all the metrics emitted to the backend
global.fedrampfedrampfalseEnables FedRAMP
global.lowDataModelowDataModefalseReduces number of metrics sent in order to reduce costs
global.privilegedprivilegedDepends on the chartIn each integration it has different behavior. See Further information but all aims to send less metrics to the backend to try to save costs
global.proxyproxy""Configures the integration to send all HTTP/HTTPS request through the proxy in that URL. The URL should have a standard format like https://user:password@hostname:port
global.nrStagingnrStagingfalseSend the metrics to the staging backend. Requires a valid staging license key
global.verboseLogverboseLogfalseSets the debug/trace logs to this integration or all integrations if it is set globally

Further information

1. Merged

Merged means that the values from global are not replaced by the local ones. Think in this example:

global:
  labels:
    global: global
  hostNetwork: true
  nodeSelector:
    global: global

labels:
  local: local
nodeSelector:
  local: local
hostNetwork: false

This values will template hostNetwork to false, a map of labels { "global": "global", "local": "local" } and a nodeSelector with { "local": "local" }.

As Helm by default merges all the maps it could be confusing that we have two behaviors (merging labels and replacing nodeSelector) the values from global to local. This is the rationale behind this:

  • hostNetwork is templated to false because is overriding the value defined globally.
  • labels are merged because the user may want to label all the New Relic pods at once and label other solution pods differently for clarity' sake.
  • nodeSelector does not merge as labels because could make it harder to overwrite/delete a selector that comes from global because of the logic that Helm follows merging maps.

2. Fine grain registries

Some charts only have 1 image while others that can have 2 or more images. The local path for the registry can change depending on the chart itself.

As this is mostly unique per helm chart, you should take a look to the chart's values table (or directly to the values.yaml file to see all the images that you can change.

This should only be needed if you have an advanced setup that forces you to have granularity enough to force a proxy/cache registry per integration.

3. Privileged mode

By default, from the common library, the privileged mode is set to false. But most of the helm charts require this to be true to fetch more metrics so could see a true in some charts. The consequences of the privileged mode differ from one chart to another so for each chart that honors the privileged mode toggle should be a section in the README explaining which is the behavior with it enabled or disabled.

Deploy common-library with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has common-library on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcommon-library is pinned at v2.3.5 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply