Skip to content

Commit 771bd49

Browse files
committed
Add functionality to allow configuring the loglevel the operator is deployed with in the Helm chart.
This introduces a variable called 'logLevel' which, when set to an empty string is not propagated to the deployment by the Helm chart at all, so that the default value for the loglevel in the operator code remains effective. When set to a non-empty string the value is propagated as environment variable <PRODUCTNAME>_OPERATOR_LOG into the pod template of the operator deployment. Additionally this adds code to the Tiltfile that allows configuring this via a local override, in a similar fashion to what we already allow for the default registry. Users can create a file called `tilt_options.json` and in there define a loglevel as follows: { "loglevel": "DEBUG" } When this file is present the value from here will be read and passed to the Helm chart by Tilt. If this file is not present, an empty string is passed through, triggering the behavior described above where the default loglevel defined in the operator code remains effective. This PR doesn't introduce a default for the 'logLevel' variable in the Helm charts, as the values.yaml files are not managed by templating. However adding a default for that variable should be an optional step, that we can do later at our convenience, or totally omit.
1 parent dbc3928 commit 771bd49

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

template/Tiltfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# If tilt_options.json exists read it and load the default_registry value from it
22
settings = read_json('tilt_options.json', default={})
33
registry = settings.get('default_registry', 'oci.stackable.tech/sandbox')
4+
loglevel = settings.get('loglevel', '')
45

56
# Configure default registry either read from config file above, or with default value of "oci.stackable.tech/sandbox"
67
default_registry(registry)
@@ -35,6 +36,7 @@ helm_crds, helm_non_crds = filter_yaml(
3536
namespace="stackable-operators",
3637
set=[
3738
'image.repository=' + registry + '/' + operator_name,
39+
'logLevel=' + loglevel
3840
],
3941
),
4042
api_version = "^apiextensions\\.k8s\\.io/.*$",

template/deploy/helm/[[operator]]/templates/deployment.yaml.j2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ spec:
5252
- name: KUBERNETES_CLUSTER_DOMAIN
5353
value: {{ .Values.kubernetesClusterDomain | quote }}
5454
{{- end }}
55+
{{- if .Values.logLevel }}
56+
- name: {[ operator.product_string | upper }]_OPERATOR_LOG
57+
value: {{ .Values.logLevel | quote }}
58+
{{- end }}
5559
{[% if operator.product_string in ['kafka'] %}]
5660
- name: KAFKA_BROKER_CLUSTERROLE
5761
value: {{ include "operator.fullname" . }}-kafka-broker-clusterrole

0 commit comments

Comments
 (0)