Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 15 additions & 25 deletions charts/newrelic-logging/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -63,51 +63,41 @@ Return the licenseKey
Return the cluster name
*/}}
{{- define "newrelic-logging.cluster" -}}
{{- if .Values.global}}
{{- if .Values.cluster }}
{{- .Values.cluster -}}
{{- else if .Values.global }}
{{- if .Values.global.cluster }}
{{- .Values.global.cluster -}}
{{- else -}}
{{- .Values.cluster | default "" -}}
{{- end -}}
{{- else -}}
{{- .Values.cluster | default "" -}}
{{- end -}}
{{- end -}}

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

{{/*
Return the customSecretLicenseKey
*/}}
{{- define "newrelic-logging.customSecretKey" -}}
{{- if .Values.global }}
{{- if .Values.customSecretLicenseKey }}
{{- .Values.customSecretLicenseKey -}}
{{- else if .Values.customSecretKey }}
{{- .Values.customSecretKey -}}
{{- else if .Values.global }}
{{- if .Values.global.customSecretLicenseKey }}
{{- .Values.global.customSecretLicenseKey -}}
{{- else -}}
{{- if .Values.global.customSecretKey }}
{{- .Values.global.customSecretKey -}}
{{- else -}}
{{- .Values.customSecretKey | default "" -}}
{{- end -}}
{{- end -}}
{{- else -}}
{{- if .Values.customSecretLicenseKey }}
{{- .Values.customSecretLicenseKey -}}
{{- else -}}
{{- .Values.customSecretKey | default "" -}}
{{- .Values.global.customSecretLicenseKey -}}
{{- else if .Values.global.customSecretKey }}
{{- .Values.global.customSecretKey -}}
{{- end -}}
{{- end -}}
{{- end -}}
Expand Down
67 changes: 49 additions & 18 deletions charts/newrelic-logging/templates/daemonset-windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
namespace: {{ $.Release.Namespace }}
labels:
kubernetes.io/os: windows
{{ include "newrelic-logging.labels" $ | indent 4 }}
{{- include "newrelic.common.labels" $ | nindent 4 }}
name: {{ template "newrelic-logging.fullname" $ }}-windows-{{ .version }}
annotations:
{{- if $.Values.daemonSet.annotations }}
Expand All @@ -17,8 +17,7 @@ spec:
type: {{ $.Values.updateStrategy }}
selector:
matchLabels:
app: {{ template "newrelic-logging.name" $ }}
release: {{ $.Release.Name }}
{{- include "newrelic.common.labels.selectorLabels" $ | nindent 6 }}
kubernetes.io/os: windows
template:
metadata:
Expand All @@ -28,13 +27,8 @@ spec:
{{ toYaml $.Values.podAnnotations | indent 8}}
{{- end }}
labels:
app: {{ template "newrelic-logging.name" $ }}
release: {{ $.Release.Name }}
kubernetes.io/os: windows
app.kubernetes.io/name: {{ template "newrelic-logging.name" $ }}
{{- if $.Values.podLabels}}
{{ toYaml $.Values.podLabels | indent 8 }}
{{- end }}
{{- include "newrelic.common.labels.podLabels" $ | nindent 8 }}
spec:
serviceAccountName: {{ include "newrelic.common.serviceAccount.name" $ }}
{{- with include "newrelic.common.dnsConfig" $ }}
Expand All @@ -47,8 +41,16 @@ spec:
imagePullSecrets:
{{- . | nindent 8 }}
{{- end }}
{{- if $.Values.hostNetwork }}
hostNetwork: {{ $.Values.hostNetwork }}
{{- $hostNetwork := false }}
{{- if not (kindIs "invalid" $.Values.hostNetwork) }}
{{- $hostNetwork = $.Values.hostNetwork }}
{{- else if $.Values.global }}
{{- if not (kindIs "invalid" $.Values.global.hostNetwork) }}
{{- $hostNetwork = $.Values.global.hostNetwork }}
{{- end }}
{{- end }}
{{- if $hostNetwork }}
hostNetwork: {{ $hostNetwork }}
{{- end }}
{{- if $.Values.windows.initContainers }}
initContainers:
Expand Down Expand Up @@ -78,8 +80,18 @@ spec:
{{- end }}
- name: CLUSTER_NAME
value: {{ include "newrelic-logging.cluster" $ }}
{{- $verboseLog := include "newrelic.common.verboseLog" $ -}}
{{- $logLevel := $.Values.fluentBit.logLevel | default "" -}}
{{- if $logLevel }}
- name: LOG_LEVEL
value: {{ $logLevel | quote }}
{{- else if $verboseLog }}
- name: LOG_LEVEL
value: {{ $.Values.fluentBit.logLevel | quote }}
value: "debug"
{{- else }}
- name: LOG_LEVEL
value: "info"
{{- end }}
- name: LOG_PARSER
{{- if $.Values.fluentBit.criEnabled }}
value: "cri,docker"
Expand Down Expand Up @@ -115,7 +127,18 @@ spec:
value: {{ $.Values.fluentBit.sendMetrics | default "false" | quote }}
- name: METRICS_HOST
value: {{ include "newrelic-logging.metricsHost" $ | quote }}
- name: FLUENTBIT_METRICS_TIER
{{- $globalProxy := "" }}
{{- if $.Values.global }}
{{- $globalProxy = $.Values.global.proxy | default "" }}
{{- end }}
{{- $proxy := $.Values.proxy | default $globalProxy | default "" }}
{{- if $proxy }}
- name: HTTP_PROXY
value: {{ $proxy | quote }}
- name: HTTPS_PROXY
value: {{ $proxy | quote }}
{{- end }}
- name: FLUENTBIT_METRICS_TIER
value: {{ $.Values.fluentBit.fluentBitMetrics | default "basic" | quote }}
{{- include "newrelic-logging.extraEnv" $ | nindent 12 }}
- name: DAEMONSET_NAME
Expand Down Expand Up @@ -181,20 +204,28 @@ spec:
- name: progdata
hostPath:
path: C:\ProgramData
{{- if $.Values.priorityClassName }}
priorityClassName: {{ $.Values.priorityClassName }}
{{- with include "newrelic.common.priorityClassName" $ }}
priorityClassName: {{ . }}
{{- end }}
{{- with include "newrelic.common.affinity" $ }}
affinity:
{{- . | nindent 8 }}
{{- end }}
{{- $nodeSelector := include "newrelic.common.nodeSelector" $ }}
nodeSelector:
{{- if $nodeSelector }}
{{- $nodeSelector | nindent 8 }}
{{- end }}
{{- if $.Values.windowsNodeSelector }}
{{ toYaml $.Values.windowsNodeSelector | indent 8 }}
{{- toYaml $.Values.windowsNodeSelector | nindent 8 }}
{{- else }}
kubernetes.io/os: windows
# Windows containers can only be executed on hosts running the exact same Windows version and build number
node.kubernetes.io/windows-build: {{ .buildNumber }}
{{- end }}
{{- if $.Values.tolerations }}
{{- with include "newrelic.common.tolerations" $ }}
tolerations:
{{ toYaml $.Values.tolerations | indent 8 }}
{{- . | nindent 8 }}
{{- end }}
---
{{- end }}
Expand Down
76 changes: 54 additions & 22 deletions charts/newrelic-logging/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ apiVersion: apps/v1
kind: DaemonSet
metadata:
namespace: {{ .Release.Namespace }}
labels: {{ include "newrelic-logging.labels" . | indent 4 }}
labels:
{{- include "newrelic.common.labels" . | nindent 4 }}
name: {{ template "newrelic-logging.fullname" . }}
annotations:
{{- if .Values.daemonSet.annotations }}
Expand All @@ -14,8 +15,7 @@ spec:
type: {{ .Values.updateStrategy }}
selector:
matchLabels:
app: {{ template "newrelic-logging.name" . }}
release: {{.Release.Name }}
{{- include "newrelic.common.labels.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
Expand All @@ -24,13 +24,8 @@ spec:
{{ toYaml .Values.podAnnotations | indent 8}}
{{- end }}
labels:
app: {{ template "newrelic-logging.name" . }}
release: {{.Release.Name }}
kubernetes.io/os: linux
app.kubernetes.io/name: {{ template "newrelic-logging.name" . }}
{{- if .Values.podLabels}}
{{ toYaml .Values.podLabels | indent 8 }}
{{- end }}
{{- include "newrelic.common.labels.podLabels" . | nindent 8 }}
spec:
serviceAccountName: {{ include "newrelic.common.serviceAccount.name" . }}
{{- with include "newrelic.common.dnsConfig" . }}
Expand All @@ -47,8 +42,16 @@ spec:
securityContext:
{{- . | nindent 8 }}
{{- end }}
{{- if .Values.hostNetwork }}
hostNetwork: {{ .Values.hostNetwork }}
{{- $hostNetwork := false }}
{{- if not (kindIs "invalid" .Values.hostNetwork) }}
{{- $hostNetwork = .Values.hostNetwork }}
{{- else if .Values.global }}
{{- if not (kindIs "invalid" .Values.global.hostNetwork) }}
{{- $hostNetwork = .Values.global.hostNetwork }}
{{- end }}
{{- end }}
{{- if $hostNetwork }}
hostNetwork: {{ $hostNetwork }}
{{- end }}
initContainers:
{{- if and (.Values.fluentBit.persistence) (eq .Values.fluentBit.persistence.mode "persistentVolume") }}
Expand Down Expand Up @@ -88,8 +91,18 @@ spec:
{{- end }}
- name: CLUSTER_NAME
value: {{ include "newrelic-logging.cluster" . }}
{{- $verboseLog := include "newrelic.common.verboseLog" . -}}
{{- $logLevel := .Values.fluentBit.logLevel | default "" -}}
{{- if $logLevel }}
- name: LOG_LEVEL
value: {{ $logLevel | quote }}
{{- else if $verboseLog }}
- name: LOG_LEVEL
value: {{ .Values.fluentBit.logLevel | quote }}
value: "debug"
{{- else }}
- name: LOG_LEVEL
value: "info"
{{- end }}
- name: LOG_PARSER
{{- if .Values.fluentBit.criEnabled }}
value: "cri,docker"
Expand Down Expand Up @@ -129,6 +142,17 @@ spec:
value: {{ $.Values.fluentBit.sendMetrics | default "false" | quote }}
- name: METRICS_HOST
value: {{ include "newrelic-logging.metricsHost" . | quote }}
{{- $globalProxy := "" }}
{{- if .Values.global }}
{{- $globalProxy = .Values.global.proxy | default "" }}
{{- end }}
{{- $proxy := .Values.proxy | default $globalProxy | default "" }}
{{- if $proxy }}
- name: HTTP_PROXY
value: {{ $proxy | quote }}
- name: HTTPS_PROXY
value: {{ $proxy | quote }}
{{- end }}
{{- include "newrelic-logging.extraEnv" . | nindent 12 }}
- name: FLUENTBIT_METRICS_TIER
value: {{ $.Values.fluentBit.fluentBitMetrics | default "basic" | quote }}
Expand Down Expand Up @@ -205,14 +229,17 @@ spec:
{{- if .Values.extraVolumes }}
{{- toYaml .Values.extraVolumes | nindent 8 }}
{{- end }}
{{- if $.Values.priorityClassName }}
priorityClassName: {{ $.Values.priorityClassName }}
{{- with include "newrelic.common.priorityClassName" . }}
priorityClassName: {{ . }}
{{- end }}
{{- if .Values.nodeAffinity }}
{{- $affinity := include "newrelic.common.affinity" . }}
{{- if or .Values.nodeAffinity $affinity (include "newrelic.fargate" .) }}
affinity:
{{- if .Values.nodeAffinity }}
nodeAffinity: {{ .Values.nodeAffinity | toYaml | nindent 10 }}
{{- else if include "newrelic.fargate" . }}
affinity:
{{- else if $affinity }}
{{- $affinity | nindent 8 }}
{{- else if include "newrelic.fargate" . }}
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
Expand All @@ -221,19 +248,24 @@ spec:
operator: NotIn
values:
- fargate
{{- end }}
{{- end }}
{{- $nodeSelector := include "newrelic.common.nodeSelector" . }}
{{- if or $nodeSelector $.Values.enableWindows }}
nodeSelector:
{{- if .Values.nodeSelector }}
{{ toYaml .Values.nodeSelector | indent 8 }}
{{- else if $.Values.enableWindows }}
{{- if $nodeSelector }}
{{- $nodeSelector | nindent 8 }}
{{- end }}
{{- if $.Values.enableWindows }}
# We add this only if Windows is enabled to keep backwards-compatibility. Prior to version 1.14, this label was
# named beta.kubernetes.io/os. In version 1.14, it was deprecated and replaced by this one. Version 1.14 also
# introduces Windows support. Therefore, anyone wishing to use Windows containers must bet at version >=1.14 and
# are going to need this label, in order to avoid placing a linux container on a windows node, and vice-versa.
kubernetes.io/os: linux
{{- end }}
{{- if .Values.tolerations }}
{{- end }}
{{- with include "newrelic.common.tolerations" . }}
tolerations:
{{ toYaml .Values.tolerations | indent 8 }}
{{- . | nindent 8 }}
{{- end }}
{{- end }}
Loading