Skip to content

Commit 5e8bee1

Browse files
authored
Merge pull request #1691 from Baarsgaard/helm_log_options
Add logging options to Helm chart
2 parents 1519bae + c3a8834 commit 5e8bee1

File tree

4 files changed

+38
-15
lines changed

4 files changed

+38
-15
lines changed

deploy/helm/grafana-operator/README.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ It's easier to just manage this configuration outside of the operator.
7373
| imagePullSecrets | list | `[]` | image pull secrets |
7474
| isOpenShift | bool | `false` | Determines if the target cluster is OpenShift. Additional rbac permissions for routes will be added on OpenShift |
7575
| leaderElect | bool | `false` | If you want to run multiple replicas of the grafana-operator, this is not recommended. |
76+
| logging.encoder | string | `"console"` | Log encoding ("console", "json") |
77+
| logging.level | string | `"info"` | Configure the verbosity of logging ("debug", "error", "info") |
78+
| logging.time | string | `"rfc3339"` | Time encoding ("epoch", "iso8601", "millis", "nano", "rfc3339", "rfc3339nano") |
7679
| metricsService.metricsPort | int | `9090` | metrics service port |
7780
| metricsService.pprofPort | int | `8888` | port for the pprof profiling endpoint |
7881
| metricsService.type | string | `"ClusterIP"` | metrics service type |
@@ -85,19 +88,21 @@ It's easier to just manage this configuration outside of the operator.
8588
| priorityClassName | string | `""` | pod priority class name |
8689
| rbac.create | bool | `true` | Specifies whether to create the ClusterRole and ClusterRoleBinding. If "namespaceScope" is true or "watchNamespaces" is set, this will create Role and RoleBinding instead. |
8790
| resources | object | `{}` | grafana operator container resources |
88-
| securityContext | object | `{"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true,"runAsNonRoot":true}` | grafana operator container security context |
91+
| securityContext.allowPrivilegeEscalation | bool | `false` | Whether to allow privilege escalation |
92+
| securityContext.capabilities | object | `{"drop":["ALL"]}` | A list of capabilities to drop |
93+
| securityContext.readOnlyRootFilesystem | bool | `true` | Whether to allow writing to the root filesystem |
94+
| securityContext.runAsNonRoot | bool | `true` | Whether to require a container to run as a non-root user |
8995
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
9096
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
9197
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
92-
| serviceMonitor | object | `{"additionalLabels":{},"enabled":false,"interval":"1m","metricRelabelings":[],"relabelings":[],"scrapeTimeout":"10s","targetLabels":[],"telemetryPath":"/metrics"}` | Enable this to use with Prometheus Operator |
9398
| serviceMonitor.additionalLabels | object | `{}` | Set of labels to transfer from the Kubernetes Service onto the target |
94-
| serviceMonitor.enabled | bool | `false` | When set true then use a ServiceMonitor to configure scraping |
99+
| serviceMonitor.enabled | bool | `false` | Whether to create a ServiceMonitor |
95100
| serviceMonitor.interval | string | `"1m"` | Set how frequently Prometheus should scrape |
96101
| serviceMonitor.metricRelabelings | list | `[]` | MetricRelabelConfigs to apply to samples before ingestion |
97102
| serviceMonitor.relabelings | list | `[]` | Set relabel_configs as per https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config |
98103
| serviceMonitor.scrapeTimeout | string | `"10s"` | Set timeout for scrape |
99104
| serviceMonitor.targetLabels | list | `[]` | Set of labels to transfer from the Kubernetes Service onto the target |
100105
| serviceMonitor.telemetryPath | string | `"/metrics"` | Set path to metrics path |
101106
| tolerations | list | `[]` | pod tolerations |
102-
| watchNamespaceSelector | string | `""` | Sets the WATCH_NAMESPACE_SELECTOR environment variable, it defines which namespaces the operator should be listening for based on label and key value pair added on namespace kind. By default it's all namespaces. |
103-
| watchNamespaces | string | `""` | Sets the WATCH_NAMESPACE environment variable, it defines which namespaces the operator should be listening for. By default it's all namespaces, if you only want to listen for the same namespace as the operator is deployed to look at namespaceScope. |
107+
| watchNamespaceSelector | string | `""` | Sets the `WATCH_NAMESPACE_SELECTOR` environment variable, it defines which namespaces the operator should be listening for based on a namespace label (e.g. `"environment: dev"`). By default, the operator watches all namespaces. To make it watch only its own namespace, check out `namespaceScope` option instead. |
108+
| watchNamespaces | string | `""` | Sets the `WATCH_NAMESPACE` environment variable, it defines which namespaces the operator should be listening for (e.g. `"grafana, foo"`). By default, the operator watches all namespaces. To make it watch only its own namespace, check out `namespaceScope` option instead. |

deploy/helm/grafana-operator/templates/deployment.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ spec:
5858
- --health-probe-bind-address=:8081
5959
- --metrics-bind-address=0.0.0.0:{{ .Values.metricsService.metricsPort }}
6060
- --pprof-addr=0.0.0.0:{{ .Values.metricsService.pprofPort }}
61+
- --zap-encoder={{ .Values.logging.encoder }}
62+
- --zap-log-level={{ .Values.logging.level }}
63+
- --zap-time-encoding={{ .Values.logging.time }}
6164
{{- if .Values.leaderElect }}
6265
- --leader-elect
6366
{{- end }}

deploy/helm/grafana-operator/values.yaml

+20-10
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,27 @@ namespaceScope: false
55
# -- If you want to run multiple replicas of the grafana-operator, this is not recommended.
66
leaderElect: false
77

8-
# -- Sets the WATCH_NAMESPACE environment variable,
9-
# it defines which namespaces the operator should be listening for.
10-
# By default it's all namespaces, if you only want to listen for the same namespace as the operator is deployed to look at namespaceScope.
8+
# -- Sets the `WATCH_NAMESPACE` environment variable,
9+
# it defines which namespaces the operator should be listening for (e.g. `"grafana, foo"`).
10+
# By default, the operator watches all namespaces. To make it watch only its own namespace, check out `namespaceScope` option instead.
1111
watchNamespaces: ""
1212

13-
# -- Sets the WATCH_NAMESPACE_SELECTOR environment variable,
14-
# it defines which namespaces the operator should be listening for based on label and key value pair added on namespace kind.
15-
# By default it's all namespaces.
13+
# -- Sets the `WATCH_NAMESPACE_SELECTOR` environment variable,
14+
# it defines which namespaces the operator should be listening for based on a namespace label (e.g. `"environment: dev"`).
15+
# By default, the operator watches all namespaces. To make it watch only its own namespace, check out `namespaceScope` option instead.
1616
watchNamespaceSelector: ""
1717

1818
# -- Determines if the target cluster is OpenShift. Additional rbac permissions for routes will be added on OpenShift
1919
isOpenShift: false
2020

21+
logging:
22+
# -- Log encoding ("console", "json")
23+
encoder: console
24+
# -- Configure the verbosity of logging ("debug", "error", "info")
25+
level: info
26+
# -- Time encoding ("epoch", "iso8601", "millis", "nano", "rfc3339", "rfc3339nano")
27+
time: rfc3339
28+
2129
# -- Additional environment variables
2230
env: []
2331
# -- grafana image, e.g. docker.io/grafana/grafana:9.1.6, overwrites the default grafana image defined in the operator
@@ -77,12 +85,16 @@ podAnnotations: {}
7785
# -- pod security context
7886
podSecurityContext: {}
7987

80-
# -- grafana operator container security context
8188
securityContext:
89+
# -- A list of capabilities to drop
8290
capabilities:
8391
drop:
8492
- ALL
93+
# -- Whether to allow privilege escalation
94+
allowPrivilegeEscalation: false
95+
# -- Whether to allow writing to the root filesystem
8596
readOnlyRootFilesystem: true
97+
# -- Whether to require a container to run as a non-root user
8698
runAsNonRoot: true
8799

88100
# -- grafana operator container resources
@@ -100,9 +112,8 @@ tolerations: []
100112
# -- pod affinity
101113
affinity: {}
102114

103-
# -- Enable this to use with Prometheus Operator
104115
serviceMonitor:
105-
# -- When set true then use a ServiceMonitor to configure scraping
116+
# -- Whether to create a ServiceMonitor
106117
enabled: false
107118
# -- Set of labels to transfer from the Kubernetes Service onto the target
108119
additionalLabels: {}
@@ -137,4 +148,3 @@ extraObjects: []
137148
# dataFrom:
138149
# - extract:
139150
# key: my-secret-store-secret
140-

deploy/kustomize/base/deployment.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,12 @@ spec:
5252
cpu: 100m
5353
memory: 20Mi
5454
securityContext:
55+
capabilities:
56+
drop:
57+
- ALL
5558
allowPrivilegeEscalation: false
59+
readOnlyRootFilesystem: true
60+
runAsNonRoot: true
5661
volumeMounts:
5762
- name: dashboards-dir
5863
mountPath: /tmp/dashboards

0 commit comments

Comments
 (0)