Skip to content

Commit

Permalink
[SRE-1094] Add support for serviceAccount. (#18)
Browse files Browse the repository at this point in the history
* [SRE-1094] Add support for serviceAccount.

Adding support for serviceAccount and its settings.
Supports adding annotations, labels and creation of the serviceAccount.

Bump chart version.
  • Loading branch information
triluch authored Nov 18, 2022
1 parent c3b53b8 commit 5195c8f
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/nobl9-agent/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v2
name: nobl9-agent
version: 1.0.2
version: 1.0.3
description: Agent to retrieve SLI metrics from configured data sources and send the data back to the Nobl9 backend.
home: https://nobl9.com
sources:
Expand Down
6 changes: 5 additions & 1 deletion charts/nobl9-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Go to the [docs.nobl9.com](https://docs.nobl9.com/Nobl9_Agent/helm-charts?_highl
| deployment.image | string | `"nobl9/agent"` | Image used by chart |
| deployment.pullPolicy | string | `"Always"` | Image Pull Policy |
| deployment.version | string | `"0.53.2"` | Agent version (image tag) |
| extraLabels | object | `{}` | |
| extraLabels | object | `{}` | Additional labels for created objects. |
| namespaceOverride | string | `nil` | Override the Namespace |
| resources.limits.cpu | string | `"1.0"` | CPU limit |
| resources.limits.memory | string | `"1Gi"` | Memory limit |
Expand All @@ -104,6 +104,10 @@ Go to the [docs.nobl9.com](https://docs.nobl9.com/Nobl9_Agent/helm-charts?_highl
| securityContext.readOnlyRootFilesystem | bool | `true` | ReadOnly file system mode if set to true |
| securityContext.runAsNonRoot | bool | `true` | Runs the container as a root user if set to false |
| securityContext.runAsUser | int | `2000` | Runs the container with specified PID |
| serviceAccount.annotations | object | `{}` | Service account annotations. |
| serviceAccount.create | bool | `true` | Allow chart to create service account. |
| serviceAccount.labels | object | `{}` | Additional labels for service account. |
| serviceAccount.name | string | `nil` | Service account name. Generated from release name by default. |

## Maintainers

Expand Down
11 changes: 11 additions & 0 deletions charts/nobl9-agent/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ Allow the secret name to be overridden
{{- end -}}
{{- end -}}

{{/*
Create the name of the service account
*/}}
{{- define "nobl9-agent.serviceAccountName" -}}
{{- if .Values.serviceAccount.create -}}
{{- default (include "nobl9-agent.fullname" .) .Values.serviceAccount.name -}}
{{- else -}}
{{- default "default" .Values.serviceAccount.name -}}
{{- end -}}
{{- end -}}

{{/*
Common labels
*/}}
Expand Down
3 changes: 2 additions & 1 deletion charts/nobl9-agent/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ spec:
{{ toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "nobl9-agent.selectorLabels" . | nindent 8 }}
{{- include "nobl9-agent.labels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "nobl9-agent.serviceAccountName" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down
16 changes: 16 additions & 0 deletions charts/nobl9-agent/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{{- if .Values.serviceAccount.create }}
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
{{- include "nobl9-agent.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
name: {{ include "nobl9-agent.serviceAccountName" . }}
namespace: {{ template "nobl9-agent.namespace" . }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/nobl9-agent/values.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -- Override the Namespace
namespaceOverride:
# -- Additional labels for created objects.
extraLabels: {}

deployment:
Expand Down Expand Up @@ -61,6 +62,17 @@ securityContext:
# -- Runs the container with specified PID
runAsUser: 2000

serviceAccount:
# -- Allow chart to create service account.
create: true
# -- Service account name. Generated from release name by default.
name:
# -- Additional labels for service account.
labels: {}
# -- Service account annotations.
annotations: {}
# eks.amazonaws.com/role-arn: arn:aws:iam::1234567890:role/iam-role

config:
# -- Nobl9 Project name
project:
Expand Down

0 comments on commit 5195c8f

Please sign in to comment.