Skip to content

Commit ed52f44

Browse files
authored
feat: The following variables have been removed: log_analysis_instance_name, log_analysis_resource_group_id, cloud_monitoring_instance_name, cloud_monitoring_resource_group_id and have been replaced by log_analysis_endpoint_type, log_analysis_instance_region, cloud_monitoring_endpoint_type and cloud_monitoring_instance_region.<br>* The following new variables are available for extra customisation: cloud_monitoring_agent_tolerations, cloud_monitoring_agent_namespace, cloud_monitoring_agent_name, cloud_monitoring_secret_name, log_analysis_agent_tolerations, log_analysis_agent_namespace, log_analysis_agent_name, log_analysis_secret_name<br>* Added an initContainer which sets the permissions on /var/lib/logdna which are required for the agent container to use the database which is required to enable the loopback feature. (#268)
1 parent dc2db18 commit ed52f44

23 files changed

+367
-275
lines changed

README.md

Lines changed: 31 additions & 43 deletions
Large diffs are not rendered by default.

catalogValidationValues.json.template

Lines changed: 0 additions & 1 deletion
This file was deleted.

chart/logdna-agent/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: logdna-agent
3-
description: A Helm chart for a logdna or activity tracker agent
3+
description: A Helm chart for a logdna agent
44

55
type: application
66

chart/logdna-agent/templates/clusterrole.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,16 @@ rules:
1313
- apiGroups: [""]
1414
resources: ["pods"]
1515
verbs: ["get","list", "watch"]
16+
17+
# Below rules are not included in the Openshift yaml so are commented out below:
18+
# https://assets.<REGION>.logging.cloud.ibm.com/clients/logdna-agent/<VERSION>/agent-resources-openshift-private.yaml
19+
20+
# - apiGroups: [""]
21+
# resources: ["nodes"]
22+
# verbs: ["get","list", "watch"]
23+
# - apiGroups: ["metrics.k8s.io"]
24+
# resources: ["pods"]
25+
# verbs: ["get","list", "watch"]
26+
# - apiGroups: ["metrics.k8s.io"]
27+
# resources: ["nodes"]
28+
# verbs: ["get","list", "watch"]

chart/logdna-agent/templates/clusterrolebinding.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ apiVersion: rbac.authorization.k8s.io/v1
22
kind: ClusterRoleBinding
33
metadata:
44
name: "{{ .Values.metadata.name }}"
5-
namespace: {{ .Release.Namespace }}
65
labels:
76
app.kubernetes.io/name: "{{ .Values.metadata.name }}"
87
app.kubernetes.io/instance: "{{ .Values.metadata.name }}"

chart/logdna-agent/templates/daemonset.yaml

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ metadata:
77
app.kubernetes.io/name: "{{ .Values.metadata.name }}"
88
app.kubernetes.io/instance: "{{ .Values.metadata.name }}"
99
app.kubernetes.io/version: {{ .Values.image.version }}
10+
annotations:
11+
{{- range .Values.checkov_skips }}
12+
{{- . | toYaml | nindent 4 -}}
13+
{{- end }}
1014
spec:
1115
updateStrategy:
1216
type: RollingUpdate
@@ -25,11 +29,23 @@ spec:
2529
spec:
2630
serviceAccountName: "{{ .Values.metadata.name }}"
2731
priorityClassName: "{{ .Values.metadata.name }}-ds-priority"
32+
initContainers:
33+
- name: logdna-db-permissions
34+
image: icr.io/goldeneye_images/ubi8-cluster-tools:stable
35+
imagePullPolicy: IfNotPresent # Not setting to 'Always' as it can prevent a pod from starting if the image registry can not be reached.
36+
command: ["sh", "-c", "chmod -R 775 {{.Values.agent.dbPath}} && chown -R 5000:5000 {{.Values.agent.dbPath}}"]
37+
securityContext:
38+
privileged: true
39+
runAsUser: 0 # must run as root to set directory privileges up for agent container
40+
volumeMounts:
41+
- name: varliblogdna
42+
mountPath: {{.Values.agent.dbPath}}
2843
containers:
2944
- name: "{{ .Values.metadata.name }}"
3045
image: '{{ .Values.image.registry }}:{{ required "Agent version must be provided" .Values.image.version }}'
31-
imagePullPolicy: Always
46+
imagePullPolicy: IfNotPresent # Not setting to 'Always' as it can prevent a pod from starting if the image registry can not be reached.
3247
securityContext:
48+
privileged: true
3349
# run the agent as non-root
3450
runAsUser: 5000
3551
runAsGroup: 5000
@@ -44,21 +60,16 @@ spec:
4460
secretKeyRef:
4561
key: logdna-agent-key
4662
name: {{ .Values.secret.name }}
47-
{{- if ne .Values.metadata.name "logdna-agent-activity-tracker" }}
48-
- name: LOGDNA_HOST
49-
value: logs.private.{{ .Values.env.region }}.logging.cloud.ibm.com
50-
{{- else }}
5163
- name: LOGDNA_HOST
52-
value: ingest.private.{{ .Values.env.region }}.atracker.cloud.ibm.com
53-
{{- end }}
64+
value: {{ .Values.env.host }}
5465
- name: LOGDNA_LOOKBACK
5566
value: smallfiles
5667
{{- if .Values.agent.tags }}
5768
- name: LOGDNA_TAGS
5869
value: {{.Values.agent.tags}}
5970
{{- end }}
6071
- name: LOGDNA_DB_PATH
61-
value: /var/lib/logdna
72+
value: {{.Values.agent.dbPath}}
6273
- name: LOGDNA_REDACT_REGEX
6374
# regex to redact secret values from logs. The regex is set to match base64-encoded values for each of {"kid":, {"typ":, and {"alg":, respectively.
6475
value: 'eyJ(?:raWQ|0eXA|hbGc)iOi[^"]+'
@@ -91,16 +102,12 @@ spec:
91102
limits:
92103
memory: 500Mi
93104
volumeMounts:
94-
{{- if eq .Values.metadata.name "logdna-agent-activity-tracker" }}
95-
- name: varlogat
96-
mountPath: /var/log/at
97-
{{- end }}
98105
- name: varlog
99106
mountPath: /var/log
100107
- name: vardata
101108
mountPath: /var/data
102109
- name: varliblogdna
103-
mountPath: /var/lib/logdna
110+
mountPath: {{.Values.agent.dbPath}}
104111
- name: varlibdockercontainers
105112
mountPath: /var/lib/docker/containers
106113
readOnly: true
@@ -112,11 +119,6 @@ spec:
112119
- name: logdnahostname
113120
mountPath: /etc/logdna-hostname
114121
volumes:
115-
{{- if eq .Values.metadata.name "logdna-agent-activity-tracker" }}
116-
- name: varlogat
117-
hostPath:
118-
path: /var/log/at
119-
{{- end }}
120122
- name: varlog
121123
hostPath:
122124
path: /var/log
@@ -125,7 +127,7 @@ spec:
125127
path: /var/data
126128
- name: varliblogdna
127129
hostPath:
128-
path: /var/lib/logdna
130+
path: {{.Values.agent.dbPath}}
129131
- name: varlibdockercontainers
130132
hostPath:
131133
path: /var/lib/docker/containers
@@ -139,4 +141,10 @@ spec:
139141
hostPath:
140142
path: /etc/hostname
141143
tolerations:
142-
- operator: Exists
144+
{{- range $val := .Values.tolerations }}
145+
- effect: {{ $val.effect | quote }}
146+
key: {{ $val.key | quote }}
147+
value: {{ $val.value | quote }}
148+
operator: {{ $val.operator | quote }}
149+
tolerationSeconds: {{ $val.tolerationSeconds }}
150+
{{- end}}

chart/logdna-agent/templates/role.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ metadata:
77
app.kubernetes.io/name: "{{ .Values.metadata.name }}"
88
app.kubernetes.io/instance: "{{ .Values.metadata.name }}"
99
app.kubernetes.io/version: {{ .Values.image.version }}
10+
annotations:
11+
{{- range .Values.checkov_skips }}
12+
{{- . | toYaml | nindent 4 -}}
13+
{{- end }}
1014
rules:
1115
- apiGroups: [""]
1216
resources: ["configmaps"]

chart/logdna-agent/templates/rolebinding.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ metadata:
77
app.kubernetes.io/name: "{{ .Values.metadata.name }}"
88
app.kubernetes.io/instance: "{{ .Values.metadata.name }}"
99
app.kubernetes.io/version: {{ .Values.image.version }}
10+
annotations:
11+
{{- range .Values.checkov_skips }}
12+
{{- . | toYaml | nindent 4 -}}
13+
{{- end }}
1014
roleRef:
1115
apiGroup: rbac.authorization.k8s.io
1216
kind: Role

chart/logdna-agent/templates/secret.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
{{- if (eq .Values.metadata.name "logdna-agent") }}
21
apiVersion: v1
32
data:
43
logdna-agent-key: '{{ required "LogDNA Ingest key must be provided" .Values.secret.key | b64enc }}'
@@ -10,5 +9,8 @@ metadata:
109
app.kubernetes.io/name: {{ .Values.metadata.name }}
1110
app.kubernetes.io/instance: {{ .Values.metadata.name }}
1211
app.kubernetes.io/version: {{ .Values.image.version }}
12+
annotations:
13+
{{- range .Values.checkov_skips }}
14+
{{- . | toYaml | nindent 4 -}}
15+
{{- end }}
1316
type: Opaque
14-
{{- end }}

chart/logdna-agent/templates/serviceaccount.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@ metadata:
77
app.kubernetes.io/name: "{{ .Values.metadata.name }}"
88
app.kubernetes.io/instance: "{{ .Values.metadata.name }}"
99
app.kubernetes.io/version: {{ .Values.image.version }}
10+
annotations:
11+
{{- range .Values.checkov_skips }}
12+
{{- . | toYaml | nindent 4 -}}
13+
{{- end }}

0 commit comments

Comments
 (0)