From be361bce636e40e8d07b6da328e693841e6644e7 Mon Sep 17 00:00:00 2001 From: Krzysztof Greczka Date: Wed, 14 Sep 2022 10:54:21 +0200 Subject: [PATCH 1/8] use correct intake uri --- charts/nobl9-agent/README.md | 2 +- charts/nobl9-agent/values.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/nobl9-agent/README.md b/charts/nobl9-agent/README.md index 15aaede..f0f4640 100644 --- a/charts/nobl9-agent/README.md +++ b/charts/nobl9-agent/README.md @@ -25,7 +25,7 @@ Agent to retrieve SLI metrics from configured data sources and send the data bac | config.clientId | string | `""` | Nobl9 Client ID, creates secret with this value, leave empty and use deployment.extraEnvs to load from existing Secret | | config.clientSecret | string | `""` | Nobl9 Client secret, creates secret with this value, leave empty and use deployment.extraEnvs to load from existing Secret | | config.datasourceName | string | `""` | Nobl9 Data Source name | -| config.intakeUrl | string | `"https://nobl9.com/api/input"` | Nobl9 API URL | +| config.intakeUrl | string | `"https://app.nobl9.com/api/input"` | Nobl9 API URL | | config.oktaOrgUrl | string | `"https://accounts.nobl9.com"` | Nobl9 Okta Organization URL | | config.organization | string | `""` | Nobl9 Organization name | | config.project | string | `"default"` | Nobl9 Project name | diff --git a/charts/nobl9-agent/values.yaml b/charts/nobl9-agent/values.yaml index f146108..a1b8087 100644 --- a/charts/nobl9-agent/values.yaml +++ b/charts/nobl9-agent/values.yaml @@ -72,7 +72,7 @@ config: clientSecret: "" # -- Nobl9 API URL - intakeUrl: "https://nobl9.com/api/input" + intakeUrl: "https://app.nobl9.com/api/input" # -- Nobl9 Auth Server ID authServer: "auseg9kiegWKEtJZC416" # -- Nobl9 Okta Organization URL From 9fcd95f6c02fc0010c371a378b75013de765d5f2 Mon Sep 17 00:00:00 2001 From: Krzysztof Greczka Date: Wed, 14 Sep 2022 10:56:02 +0200 Subject: [PATCH 2/8] set version to latest --- charts/nobl9-agent/README.md | 4 ++-- charts/nobl9-agent/values.yaml | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/charts/nobl9-agent/README.md b/charts/nobl9-agent/README.md index f0f4640..8465bf7 100644 --- a/charts/nobl9-agent/README.md +++ b/charts/nobl9-agent/README.md @@ -34,8 +34,8 @@ Agent to retrieve SLI metrics from configured data sources and send the data bac | deployment.extraLabels | object | `{}` | Additional Labels | | deployment.image | string | `"nobl9/agent"` | Image used by chart | | deployment.pullPolicy | string | `"Always"` | Image Pull Policy | -| deployment.version | string | `"0.48.0"` | Agent version (image tag) | -| namespaceOverride | string | `nil` | Override the namespace | +| deployment.version | string | `"latest"` | Agent version (image tag) | +| namespaceOverride | string | `nil` | Override the Namespace | | resources.limits.cpu | string | `"1.0"` | CPU limit | | resources.limits.memory | string | `"1Gi"` | Memory limit | | resources.requests.cpu | string | `"0.1"` | CPU request | diff --git a/charts/nobl9-agent/values.yaml b/charts/nobl9-agent/values.yaml index a1b8087..802ac04 100644 --- a/charts/nobl9-agent/values.yaml +++ b/charts/nobl9-agent/values.yaml @@ -1,11 +1,11 @@ -# -- Override the namespace +# -- Override the Namespace namespaceOverride: deployment: # -- Image used by chart - image: "nobl9/agent" + image: nobl9/agent # -- Agent version (image tag) - version: "0.48.0" + version: latest # -- Image Pull Policy pullPolicy: Always # -- Additional Envs From ace15b754668ce1b3f84ddfb9a3dc9afa58feed1 Mon Sep 17 00:00:00 2001 From: Krzysztof Greczka Date: Wed, 14 Sep 2022 10:56:32 +0200 Subject: [PATCH 3/8] allow to override secret name --- charts/nobl9-agent/README.md | 1 + charts/nobl9-agent/templates/_helpers.tpl | 11 +++++++++++ charts/nobl9-agent/templates/secret.yaml | 2 +- charts/nobl9-agent/values.yaml | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/charts/nobl9-agent/README.md b/charts/nobl9-agent/README.md index 8465bf7..ac9c0ef 100644 --- a/charts/nobl9-agent/README.md +++ b/charts/nobl9-agent/README.md @@ -41,6 +41,7 @@ Agent to retrieve SLI metrics from configured data sources and send the data bac | resources.requests.cpu | string | `"0.1"` | CPU request | | resources.requests.memory | string | `"350Mi"` | Memory request | | secret.extraData | string | `nil` | Extra stringData to be included in secret, use deployment.extraEnvs to load as deployment Envs | +| secret.nameOverride | string | `nil` | Override the Secret name | | securityContext.allowPrivilegeEscalation | bool | `false` | Grants container a privileged status if set to true | | 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 | diff --git a/charts/nobl9-agent/templates/_helpers.tpl b/charts/nobl9-agent/templates/_helpers.tpl index 6813e3f..190f274 100644 --- a/charts/nobl9-agent/templates/_helpers.tpl +++ b/charts/nobl9-agent/templates/_helpers.tpl @@ -37,3 +37,14 @@ Allow the release namespace to be overridden for multi-namespace deployments in {{- .Release.Namespace -}} {{- end -}} {{- end -}} + +{{/* +Allow the secret name to be overridden +*/}} +{{- define "nobl9-agent.secret.name" -}} + {{- if .Values.secret.nameOverride -}} + {{- .Values.secret.nameOverride -}} + {{- else -}} + {{ template "nobl9-agent.fullname" . }} + {{- end -}} +{{- end -}} diff --git a/charts/nobl9-agent/templates/secret.yaml b/charts/nobl9-agent/templates/secret.yaml index fc02602..ac717de 100644 --- a/charts/nobl9-agent/templates/secret.yaml +++ b/charts/nobl9-agent/templates/secret.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: Secret metadata: - name: {{ template "nobl9-agent.fullname" . }} + name: {{ template "nobl9-agent.secret.name" . }} namespace: {{ template "nobl9-agent.namespace" . }} labels: helm.sh/chart: {{ template "nobl9-agent.chart" . }} diff --git a/charts/nobl9-agent/values.yaml b/charts/nobl9-agent/values.yaml index 802ac04..bf3358c 100644 --- a/charts/nobl9-agent/values.yaml +++ b/charts/nobl9-agent/values.yaml @@ -33,6 +33,8 @@ deployment: extraLabels: {} secret: + # -- Override the Secret name + nameOverride: # -- Extra stringData to be included in secret, use deployment.extraEnvs to load as deployment Envs extraData: # splunk_api_token: my-api-token From 07a9de64fcb98911f31cc193b57aeac72c907b5b Mon Sep 17 00:00:00 2001 From: Krzysztof Greczka Date: Wed, 14 Sep 2022 11:17:13 +0200 Subject: [PATCH 4/8] use helpers to define labels --- charts/nobl9-agent/README.md | 12 ++++---- charts/nobl9-agent/templates/_helpers.tpl | 32 ++++++++++++++++++++ charts/nobl9-agent/templates/deployment.yaml | 22 ++------------ charts/nobl9-agent/templates/secret.yaml | 6 +--- charts/nobl9-agent/values.yaml | 12 ++++---- 5 files changed, 48 insertions(+), 36 deletions(-) diff --git a/charts/nobl9-agent/README.md b/charts/nobl9-agent/README.md index ac9c0ef..c3d74d4 100644 --- a/charts/nobl9-agent/README.md +++ b/charts/nobl9-agent/README.md @@ -22,19 +22,19 @@ Agent to retrieve SLI metrics from configured data sources and send the data bac |-----|------|---------|-------------| | config.allowedUrls | string | `nil` | Populates N9_ALLOWED_URLS that limits the URLs which an Agent is able to query | | config.authServer | string | `"auseg9kiegWKEtJZC416"` | Nobl9 Auth Server ID | -| config.clientId | string | `""` | Nobl9 Client ID, creates secret with this value, leave empty and use deployment.extraEnvs to load from existing Secret | -| config.clientSecret | string | `""` | Nobl9 Client secret, creates secret with this value, leave empty and use deployment.extraEnvs to load from existing Secret | -| config.datasourceName | string | `""` | Nobl9 Data Source name | +| config.clientId | string | `nil` | Nobl9 Client ID, creates secret with this value, leave empty and use deployment.extraEnvs to load from existing Secret | +| config.clientSecret | string | `nil` | Nobl9 Client secret, creates secret with this value, leave empty and use deployment.extraEnvs to load from existing Secret | +| config.datasourceName | string | `nil` | Nobl9 Data Source name | | config.intakeUrl | string | `"https://app.nobl9.com/api/input"` | Nobl9 API URL | | config.oktaOrgUrl | string | `"https://accounts.nobl9.com"` | Nobl9 Okta Organization URL | -| config.organization | string | `""` | Nobl9 Organization name | -| config.project | string | `"default"` | Nobl9 Project name | +| config.organization | string | `nil` | Nobl9 Organization name | +| config.project | string | `nil` | Nobl9 Project name | | deployment.annotations | object | `{}` | Custom annotations | | deployment.extraEnvs | string | `nil` | Additional Envs | -| deployment.extraLabels | object | `{}` | Additional Labels | | deployment.image | string | `"nobl9/agent"` | Image used by chart | | deployment.pullPolicy | string | `"Always"` | Image Pull Policy | | deployment.version | string | `"latest"` | Agent version (image tag) | +| extraLabels | object | `{}` | | | namespaceOverride | string | `nil` | Override the Namespace | | resources.limits.cpu | string | `"1.0"` | CPU limit | | resources.limits.memory | string | `"1Gi"` | Memory limit | diff --git a/charts/nobl9-agent/templates/_helpers.tpl b/charts/nobl9-agent/templates/_helpers.tpl index 190f274..e327197 100644 --- a/charts/nobl9-agent/templates/_helpers.tpl +++ b/charts/nobl9-agent/templates/_helpers.tpl @@ -48,3 +48,35 @@ Allow the secret name to be overridden {{ template "nobl9-agent.fullname" . }} {{- end -}} {{- end -}} + +{{/* +Common labels +*/}} +{{- define "nobl9-agent.labels" -}} +helm.sh/chart: {{ include "nobl9-agent.chart" . }} +{{ include "nobl9-agent.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- if .Values.extraLabels }} +{{ toYaml .Values.extraLabels }} +{{- end }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "nobl9-agent.selectorLabels" -}} +app.kubernetes.io/name: {{ include "nobl9-agent.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Values.config.datasourceName }} +nobl9.com/agent-datasource-name: {{ .Values.config.datasourceName }} +{{- end }} +{{- if .Values.config.project }} +nobl9.com/agent-project: {{ .Values.config.project }} +{{- end }} +{{- if .Values.config.organization }} +nobl9.com/agent-organization: {{ .Values.config.organization }} +{{- end }} +{{- end -}} diff --git a/charts/nobl9-agent/templates/deployment.yaml b/charts/nobl9-agent/templates/deployment.yaml index 3e9ebf6..b0909b3 100644 --- a/charts/nobl9-agent/templates/deployment.yaml +++ b/charts/nobl9-agent/templates/deployment.yaml @@ -4,22 +4,12 @@ metadata: name: {{ template "nobl9-agent.fullname" . }} namespace: {{ template "nobl9-agent.namespace" . }} labels: - helm.sh/chart: {{ template "nobl9-agent.chart" . }} - app.kubernetes.io/name: {{ template "nobl9-agent.name" . }} - app.kubernetes.io/managed-by: {{ .Release.Service | quote }} - app.kubernetes.io/instance: {{ .Release.Name | quote }} - app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} - {{- with .Values.deployment.extraLabels }} - {{ toYaml . | nindent 4 }} - {{- end }} + {{- include "nobl9-agent.labels" . | nindent 4 }} spec: replicas: 1 selector: matchLabels: - app.kubernetes.io/name: {{ template "nobl9-agent.name" . }} - nobl9.com/agent-name: {{ .Values.config.datasourceName | quote }} - nobl9.com/agent-project: {{ .Values.config.project | quote }} - nobl9.com/agent-organization: {{ .Values.config.organization | quote }} + {{- include "nobl9-agent.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.deployment.annotations }} @@ -27,13 +17,7 @@ spec: {{ toYaml . | nindent 8 }} {{- end }} labels: - app.kubernetes.io/name: {{ template "nobl9-agent.name" . }} - nobl9.com/agent-name: {{ .Values.config.datasourceName | quote }} - nobl9.com/agent-project: {{ .Values.config.project | quote }} - nobl9.com/agent-organization: {{ .Values.config.organization | quote }} - {{- with .Values.extraLabels }} - {{ toYaml . | nindent 8 }} - {{- end }} + {{- include "nobl9-agent.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: diff --git a/charts/nobl9-agent/templates/secret.yaml b/charts/nobl9-agent/templates/secret.yaml index ac717de..761ba6f 100644 --- a/charts/nobl9-agent/templates/secret.yaml +++ b/charts/nobl9-agent/templates/secret.yaml @@ -5,11 +5,7 @@ metadata: name: {{ template "nobl9-agent.secret.name" . }} namespace: {{ template "nobl9-agent.namespace" . }} labels: - helm.sh/chart: {{ template "nobl9-agent.chart" . }} - app.kubernetes.io/name: {{ template "nobl9-agent.name" . }} - app.kubernetes.io/managed-by: {{ .Release.Service | quote }} - app.kubernetes.io/instance: {{ .Release.Name | quote }} - app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} + {{- include "nobl9-agent.labels" . | nindent 4 }} type: Opaque stringData: {{- if .Values.config.clientId }} diff --git a/charts/nobl9-agent/values.yaml b/charts/nobl9-agent/values.yaml index bf3358c..562cd16 100644 --- a/charts/nobl9-agent/values.yaml +++ b/charts/nobl9-agent/values.yaml @@ -1,5 +1,6 @@ # -- Override the Namespace namespaceOverride: +extraLabels: {} deployment: # -- Image used by chart @@ -30,7 +31,6 @@ deployment: # -- Custom annotations annotations: {} # -- Additional Labels - extraLabels: {} secret: # -- Override the Secret name @@ -63,15 +63,15 @@ securityContext: config: # -- Nobl9 Project name - project: "default" + project: # -- Nobl9 Organization name - organization: "" + organization: # -- Nobl9 Data Source name - datasourceName: "" + datasourceName: # -- Nobl9 Client ID, creates secret with this value, leave empty and use deployment.extraEnvs to load from existing Secret - clientId: "" + clientId: # -- Nobl9 Client secret, creates secret with this value, leave empty and use deployment.extraEnvs to load from existing Secret - clientSecret: "" + clientSecret: # -- Nobl9 API URL intakeUrl: "https://app.nobl9.com/api/input" From 98d56f178ef6d3be66e3aab3ac0daea0b17c416e Mon Sep 17 00:00:00 2001 From: Krzysztof G at nobl9 <106727629+kgreczka9@users.noreply.github.com> Date: Wed, 14 Sep 2022 11:39:12 +0200 Subject: [PATCH 5/8] update indendation Co-authored-by: Andrzej Voss --- charts/nobl9-agent/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/nobl9-agent/templates/deployment.yaml b/charts/nobl9-agent/templates/deployment.yaml index b0909b3..b980a45 100644 --- a/charts/nobl9-agent/templates/deployment.yaml +++ b/charts/nobl9-agent/templates/deployment.yaml @@ -17,7 +17,7 @@ spec: {{ toYaml . | nindent 8 }} {{- end }} labels: - {{- include "nobl9-agent.selectorLabels" . | nindent 8 }} + {{- include "nobl9-agent.selectorLabels" . | nindent 8 }} spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: From e58b622b7701749c89645ffd7345fe8bc1c54a3e Mon Sep 17 00:00:00 2001 From: Krzysztof G at nobl9 <106727629+kgreczka9@users.noreply.github.com> Date: Wed, 14 Sep 2022 11:39:16 +0200 Subject: [PATCH 6/8] update indendation Co-authored-by: Andrzej Voss --- charts/nobl9-agent/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/nobl9-agent/templates/deployment.yaml b/charts/nobl9-agent/templates/deployment.yaml index b980a45..538a665 100644 --- a/charts/nobl9-agent/templates/deployment.yaml +++ b/charts/nobl9-agent/templates/deployment.yaml @@ -9,7 +9,7 @@ spec: replicas: 1 selector: matchLabels: - {{- include "nobl9-agent.selectorLabels" . | nindent 6 }} + {{- include "nobl9-agent.selectorLabels" . | nindent 6 }} template: metadata: {{- with .Values.deployment.annotations }} From 6e6cda7394cd5a7091fa8329738ff761ede20cd8 Mon Sep 17 00:00:00 2001 From: Krzysztof Greczka Date: Wed, 14 Sep 2022 11:42:53 +0200 Subject: [PATCH 7/8] use static version --- charts/nobl9-agent/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/nobl9-agent/values.yaml b/charts/nobl9-agent/values.yaml index 562cd16..88819b4 100644 --- a/charts/nobl9-agent/values.yaml +++ b/charts/nobl9-agent/values.yaml @@ -6,7 +6,7 @@ deployment: # -- Image used by chart image: nobl9/agent # -- Agent version (image tag) - version: latest + version: "0.51.2" # -- Image Pull Policy pullPolicy: Always # -- Additional Envs From d11b752a2b7e9eb383db72431a3c1ab6b68d75af Mon Sep 17 00:00:00 2001 From: Krzysztof Greczka Date: Wed, 14 Sep 2022 11:44:55 +0200 Subject: [PATCH 8/8] update readme --- charts/nobl9-agent/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/nobl9-agent/README.md b/charts/nobl9-agent/README.md index c3d74d4..1ef5af0 100644 --- a/charts/nobl9-agent/README.md +++ b/charts/nobl9-agent/README.md @@ -33,7 +33,7 @@ Agent to retrieve SLI metrics from configured data sources and send the data bac | deployment.extraEnvs | string | `nil` | Additional Envs | | deployment.image | string | `"nobl9/agent"` | Image used by chart | | deployment.pullPolicy | string | `"Always"` | Image Pull Policy | -| deployment.version | string | `"latest"` | Agent version (image tag) | +| deployment.version | string | `"0.51.2"` | Agent version (image tag) | | extraLabels | object | `{}` | | | namespaceOverride | string | `nil` | Override the Namespace | | resources.limits.cpu | string | `"1.0"` | CPU limit |