Skip to content

Commit

Permalink
[super-agent-deployment] First iteration of the super agent chart [NR…
Browse files Browse the repository at this point in the history
…-168648] (#1155)

#### Is this a new chart
Yes

#### What this PR does / why we need it:

This is the first iteration to start to work on the deployment of the
super agent on Kubernetes.

#### 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
kang-makes authored Oct 23, 2023
1 parent 4834cb8 commit 8e5fb4d
Show file tree
Hide file tree
Showing 18 changed files with 611 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@
"patch"
],
"enabled": true
},
{
// Update Super Agent chart
"fileMatch": [ "^charts/super-agent-deployment/Chart.yaml$" ],
"datasourceTemplate": "docker",
"depNameTemplate": "newrelic/newrelic-super-agent",
"matchStrings": [
"appVersion: (?<currentValue>.*) # .*"
]
}
]
}
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@
# synthetics-job-manager
/charts/synthetics-job-manager/ @newrelic/proactive-monitoring

# Infrastructure-related charts
/charts/nri-statsd/ @newrelic/caos
/charts/super-agent-deployment/ @newrelic/coreint
23 changes: 23 additions & 0 deletions charts/super-agent-deployment/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
6 changes: 6 additions & 0 deletions charts/super-agent-deployment/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common-library
repository: https://helm-charts.newrelic.com
version: 1.1.1
digest: sha256:3c9053021f3c22aa3cdfc6781d3498bcbedb0b973af9121b1722469744fb5162
generated: "2023-10-13T15:08:34.076909+02:00"
28 changes: 28 additions & 0 deletions charts/super-agent-deployment/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: v2
name: super-agent-deployment
description: A Helm chart to install New Relic Super agent on Kubernetes

type: application
version: 0.0.0-beta
appVersion: nightly # TODO: Change this with a proper version of the image.

dependencies:
- name: common-library
version: 1.1.1
repository: https://helm-charts.newrelic.com

keywords:
- newrelic
- super-agent

maintainers:
- name: sigilioso
url: https://github.com/sigilioso
- name: gsanchezgavier
url: https://github.com/gsanchezgavier
- name: kang-makes
url: https://github.com/kang-makes
- name: marcsanmi
url: https://github.com/marcsanmi
- name: paologallinaharbur
url: https://github.com/paologallinaharbur
80 changes: 80 additions & 0 deletions charts/super-agent-deployment/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
[![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)

# super-agent-deployment

![Version: 0.0.0-beta](https://img.shields.io/badge/Version-0.0.0--beta-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: nightly](https://img.shields.io/badge/AppVersion-nightly-informational?style=flat-square)

A Helm chart to install New Relic Super agent on Kubernetes

# Helm installation

You can install this chart using directly this Helm repository:

```shell
helm repo add newrelic https://helm-charts.newrelic.com
helm upgrade --install newrelic/super-agent-deployment -f your-custom-values.yaml
```

## Values managed globally

This chart implements the [New Relic's common Helm library](https://github.com/newrelic/helm-charts/tree/master/library/common-library) which
means that it honors a wide range of defaults and globals common to most New Relic Helm charts.

Options that can be defined globally include `affinity`, `nodeSelector`, `tolerations`, `proxy` and others. The full list can be found at
[user's guide of the common library](https://github.com/newrelic/helm-charts/blob/master/library/common-library/README.md).

## Chart particularities

> **TODO:** Here is where you should add particularities for this chart like what does the chart do with the privileged and
low data modes or any other quirk that it could have.

At the point of the creation of the chart, it has no particularities and this section can be removed safely.

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Sets pod/node affinities. Can be configured also with `global.affinity` |
| cluster | string | `""` | TODO: Name of the Kubernetes cluster monitored. Can be configured also with `global.cluster`. |
| config.content | string | See `values.yaml` for examples | Here you can set New Relic' Super Agent configuration. |
| config.create | bool | `true` | Set if the configMap is going to be created by this chart or the user will provide its own. |
| config.key | string | `""` | The key in the configMap that has the configuration for the Super Agent. |
| config.name | string | `""` | The name the configMap is going to have. If create is set to false, the name of an existing configMap that will be used to config the Super Agent. |
| containerSecurityContext | object | `{}` | Sets security context (at container level). Can be configured also with `global.containerSecurityContext` |
| customAttributes | object | `{}` | TODO: Adds extra attributes to the cluster and all the metrics emitted to the backend. Can be configured also with `global.customAttributes` |
| customSecretLicenseKey | string | `""` | TODO: 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. Can be configured also with `global.customSecretLicenseKey` |
| customSecretName | string | `""` | TODO: 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. Can be configured also with `global.customSecretName` |
| dnsConfig | object | `{}` | Sets pod's dnsConfig. Can be configured also with `global.dnsConfig` |
| extraEnv | list | `[]` | Add user environment variables to the agent |
| extraEnvFrom | list | `[]` | Add user environment from configMaps or secrets as variables to the agent |
| extraVolumeMounts | list | `[]` | Defines where to mount volumes specified with `extraVolumes` |
| extraVolumes | list | `[]` | Volumes to mount in the containers |
| fedramp.enabled | bool | `false` | TODO: Enables FedRAMP. Can be configured also with `global.fedramp.enabled` |
| fullnameOverride | string | `""` | Override the full name of the release |
| hostNetwork | bool | `false` | Sets pod's hostNetwork. Can be configured also with `global.hostNetwork` |
| image | object | See `values.yaml` | Image for the New Relic Super Agent |
| image.pullSecrets | list | `[]` | The secrets that are needed to pull images from a custom registry. |
| labels | object | `{}` | Additional labels for chart objects. Can be configured also with `global.labels` |
| licenseKey | string | `""` | TODO: This set this license key to use. Can be configured also with `global.licenseKey` |
| nameOverride | string | `""` | Override the name of the chart |
| nodeSelector | object | `{}` | Sets pod's node selector. Can be configured also with `global.nodeSelector` |
| nrStaging | bool | `false` | Send the metrics to the staging backend. Requires a valid staging license key. Can be configured also with `global.nrStaging` |
| podAnnotations | object | `{}` | Annotations to be added to all pods created by the integration. |
| podLabels | object | `{}` | Additional labels for chart pods. Can be configured also with `global.podLabels` |
| podSecurityContext | object | `{}` | Sets security context (at pod level). Can be configured also with `global.podSecurityContext` |
| priorityClassName | string | `""` | Sets pod's priorityClassName. Can be configured also with `global.priorityClassName` |
| proxy | string | `""` | TODO: 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`. Can be configured also with `global.proxy` |
| rbac.create | bool | `true` | Whether the chart should automatically create the RBAC objects required to run. |
| resources | object | `{}` | Resource limits to be added to all pods created by the integration. |
| serviceAccount | object | See `values.yaml` | Settings controlling ServiceAccount creation. |
| serviceAccount.create | bool | `true` | Whether the chart should automatically create the ServiceAccount objects required to run. |
| tolerations | list | `[]` | Sets pod's tolerations to node taints. Can be configured also with `global.tolerations` |
| verboseLog | bool | `false` | TODO: Sets the debug logs to this integration or all integrations if it is set globally. Can be configured also with `global.verboseLog` |

## Maintainers

* [sigilioso](https://github.com/sigilioso)
* [gsanchezgavier](https://github.com/gsanchezgavier)
* [kang-makes](https://github.com/kang-makes)
* [marcsanmi](https://github.com/marcsanmi)
* [paologallinaharbur](https://github.com/paologallinaharbur)
51 changes: 51 additions & 0 deletions charts/super-agent-deployment/README.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[![Community Plus header](https://github.com/newrelic/opensource-website/raw/master/src/images/categories/Community_Plus.png)](https://opensource.newrelic.com/oss-category/#community-plus)

{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}

{{ template "chart.badgesSection" . }}

{{ template "chart.description" . }}

{{ template "chart.homepageLine" . }}

# Helm installation

You can install this chart using directly this Helm repository:

```shell
helm repo add newrelic https://helm-charts.newrelic.com
helm upgrade --install newrelic/super-agent-deployment -f your-custom-values.yaml
```

{{ template "chart.sourcesSection" . }}

## Values managed globally

This chart implements the [New Relic's common Helm library](https://github.com/newrelic/helm-charts/tree/master/library/common-library) which
means that it honors a wide range of defaults and globals common to most New Relic Helm charts.

Options that can be defined globally include `affinity`, `nodeSelector`, `tolerations`, `proxy` and others. The full list can be found at
[user's guide of the common library](https://github.com/newrelic/helm-charts/blob/master/library/common-library/README.md).

## Chart particularities

> **TODO:** Here is where you should add particularities for this chart like what does the chart do with the privileged and
low data modes or any other quirk that it could have.

At the point of the creation of the chart, it has no particularities and this section can be removed safely.

{{ template "chart.valuesSection" . }}

{{ if .Maintainers }}
## Maintainers
{{ range .Maintainers }}
{{- if .Name }}
{{- if .Url }}
* [{{ .Name }}]({{ .Url }})
{{- else }}
* {{ .Name }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
5 changes: 5 additions & 0 deletions charts/super-agent-deployment/ci/test-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# chart-testing need values files to test that the chart is installable and upgradable.
# The values file is needed to be populated. As we have nothing to test for now, I am filling this files with gibberish
# so the test triggers at the same time that it does not affect the default values file or any other function of the
# chart of the common library.
fake: values
42 changes: 42 additions & 0 deletions charts/super-agent-deployment/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- /*
Return the name of the configMap holding the Super Agent's config. Defaults to release's fill name suffiexed with "-config"
*/ -}}
{{- define "newrelic-super-agent.config.name" -}}
{{- .Values.config.name | default (include "newrelic.common.naming.truncateToDNSWithSuffix" ( dict "name" (include "newrelic.common.naming.fullname" .) "suffix" "config" )) -}}
{{- end -}}


{{- /*
Return the key name of the configMap holding the Super Agent's config. Defaults to "config.yaml"
*/ -}}
{{- define "newrelic-super-agent.config.key" -}}
{{- .Values.config.key | default "config.yaml" -}}
{{- end -}}
{{- /*
Builds the configuration from config on the values and add more config options like
cluster name, licenses, and custom attributes
*/ -}}
{{- define "newrelic-super-agent.config.content" -}}
{{- /*
This snippet should execute always to block all unsupported features from the common-lirary that are not yet supported
by this chart.
TODO: Remove this file when the Super Agent supports licensekey as an envVar.
*/ -}}
{{ $licenseKey := include "newrelic.common.license._licenseKey" . }}
{{- if or (include "newrelic.common.license._customSecretName" .) (include "newrelic.common.license._customSecretKey" .) -}}
{{- fail "Common library supports setting an external custom secret for the license but the super agent still does not support the license by an env var. You must specify a .licenseKey or .global.licenseKey" -}}
{{- end -}}
{{- /*
TODO: There are a lot of TODOs to be made in this chart yet and some of them are going to impact the YAML that holds
the config.
If you need a list of TODOs, just `grep TODO` on the `values.yaml` and look for things that are yet to be implemented.
*/ -}}
{{- if .Values.config.content -}}
{{- .Values.config.content | toYaml -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- if .Values.config.create -}}
---
kind: ConfigMap
metadata:
name: {{ include "newrelic-super-agent.config.name" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "newrelic.common.labels" $ | nindent 4 }}
apiVersion: v1
data:
{{ include "newrelic-super-agent.config.key" . }}: |
{{- include "newrelic-super-agent.config.content" . | nindent 4 }}
{{- end }}
101 changes: 101 additions & 0 deletions charts/super-agent-deployment/templates/deployment-superagent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
{{- include "newrelic.common.labels" . | nindent 4 }}
name: {{ include "newrelic.common.naming.fullname" . }}
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
{{- include "newrelic.common.labels.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "newrelic.common.labels.podLabels" . | nindent 8 }}
spec:
{{- with include "newrelic.common.images.renderPullSecrets" ( dict "pullSecrets" (list .Values.imagePullSecrets) "context" .) }}
imagePullSecrets:
{{- . | nindent 8 }}
{{- end }}

{{- with include "newrelic.common.priorityClassName" . }}
priorityClassName: {{ . }}
{{- end }}
{{- with include "newrelic.common.securityContext.pod" . }}
securityContext:
{{- . | nindent 8 }}
{{- end }}

{{- with include "newrelic.common.dnsConfig" . }}
dnsConfig:
{{- . | nindent 8 }}
{{- end }}

hostNetwork: {{ include "newrelic.common.hostNetwork.value" . }}
{{- if include "newrelic.common.hostNetwork" . }}
dnsPolicy: ClusterFirstWithHostNet
{{- end }}

serviceAccountName: {{ include "newrelic.common.serviceAccount.name" . }}

containers:
- name: {{ .Chart.Name }}
{{- with include "newrelic.common.securityContext.container" . }}
securityContext:
{{- . | nindent 12 }}
{{- end }}
image: {{ include "newrelic.common.images.image" ( dict "imageRoot" .Values.image "context" .) }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- --running-mode=Kubernetes

{{- with .Values.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.extraEnvFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
# TODO: Add probes

volumeMounts:
- name: super-agent-config
mountPath: /etc/newrelic-super-agent
readOnly: true

{{- with .Values.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}

resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
- name: super-agent-config
configMap:
name: {{ include "newrelic-super-agent.config.name" . }}
items:
- key: {{ include "newrelic-super-agent.config.key" . }}
path: config.yaml

{{- with .Values.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}

{{- with include "newrelic.common.nodeSelector" . }}
nodeSelector:
{{- . | nindent 8 }}
{{- end }}
{{- with include "newrelic.common.affinity" . }}
affinity:
{{- . | nindent 8 }}
{{- end }}
{{- with include "newrelic.common.tolerations" . }}
tolerations:
{{- . | nindent 8 }}
{{- end }}
Loading

0 comments on commit 8e5fb4d

Please sign in to comment.