Skip to content

Commit

Permalink
[sn-platform][sn-platform-slim]feat: add logConfig support on sn-plat…
Browse files Browse the repository at this point in the history
…form & sn-platform slim charts (#1067)

* feat: add logConfig support on snp slim chart

Signed-off-by: ericsyh <[email protected]>

* feat: add logConfig support on charts

Signed-off-by: ericsyh <[email protected]>

* add examples

Signed-off-by: ericsyh <[email protected]>

* update examples

Signed-off-by: ericsyh <[email protected]>

* fix lint ci

Signed-off-by: ericsyh <[email protected]>

* Update examples/sn-platform/logConfig.yaml

* revert my change

* Update charts/sn-platform/values.yaml

Co-authored-by: labuladong <[email protected]>

* Update charts/sn-platform/values.yaml

Co-authored-by: labuladong <[email protected]>

* fix spaces

Signed-off-by: ericsyh <[email protected]>

---------

Signed-off-by: ericsyh <[email protected]>
Co-authored-by: labuladong <[email protected]>
  • Loading branch information
ericsyh and labuladong authored Jul 28, 2023
1 parent db093dc commit 8682018
Show file tree
Hide file tree
Showing 13 changed files with 264 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/sn-console/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apiVersion: v1
appVersion: "1.13"
description: StreamNative Console Chart
name: sn-console
version: 1.13
version: 1.13.0
home: https://streamnative.io
sources:
- https://github.com/streamnative/charts/tree/master/charts/sn-console
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ spec:
replicas: {{ .Values.bookkeeper.replicaCount }}
image: "{{ .Values.images.bookie.repository }}:{{ .Values.images.bookie.tag }}"
imagePullPolicy: {{ .Values.images.bookie.pullPolicy }}
logConfig:
level: {{ .Values.bookkeeper.logConfig.level }}
format: {{ .Values.bookkeeper.logConfig.format }}
{{- with .Values.bookkeeper.logConfig.template }}
template: |
{{- toYaml . | nindent 6 -}}
{{- end }}
pod:
{{- with .Values.bookkeeper.topologySpreadConstraints }}
topologySpreadConstraints:
Expand Down
7 changes: 7 additions & 0 deletions charts/sn-platform-slim/templates/broker/broker-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ spec:
replicas: {{ .Values.broker.replicaCount }}
image: "{{ .Values.images.broker.repository }}:{{ .Values.images.broker.tag }}"
imagePullPolicy: {{ .Values.images.broker.pullPolicy }}
logConfig:
level: {{ .Values.broker.logConfig.level }}
format: {{ .Values.broker.logConfig.format }}
{{- with .Values.broker.logConfig.template }}
template: |
{{- toYaml . | nindent 6 -}}
{{- end }}
pod:
{{- with .Values.broker.topologySpreadConstraints }}
topologySpreadConstraints:
Expand Down
7 changes: 7 additions & 0 deletions charts/sn-platform-slim/templates/proxy/proxy-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ spec:
replicas: {{ .Values.proxy.replicaCount }}
image: "{{ .Values.images.proxy.repository }}:{{ .Values.images.proxy.tag }}"
imagePullPolicy: {{ .Values.images.proxy.pullPolicy }}
logConfig:
level: {{ .Values.proxy.logConfig.level }}
format: {{ .Values.proxy.logConfig.format }}
{{- with .Values.proxy.logConfig.template }}
template: |
{{- toYaml . | nindent 6 -}}
{{- end }}
pod:
{{- with .Values.proxy.topologySpreadConstraints }}
topologySpreadConstraints:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ metadata:
spec:
replicas: {{ .Values.zookeeper.replicaCount }}
image: "{{ .Values.images.zookeeper.repository }}:{{ .Values.images.zookeeper.tag }}"
logConfig:
level: {{ .Values.zookeeper.logConfig.level }}
format: {{ .Values.zookeeper.logConfig.format }}
{{- with .Values.zookeeper.logConfig.template }}
template: |
{{- toYaml . | nindent 6 -}}
{{- end }}
pod:
{{- with .Values.zookeeper.topologySpreadConstraints }}
topologySpreadConstraints:
Expand Down
44 changes: 44 additions & 0 deletions charts/sn-platform-slim/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,17 @@ zookeeper:
# annotations that will be added on the ZooKeeperCluster CR only.
annotations: {}

# The field logConfig can be used to change the log level and log format of pods.
# The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml.
# If it is specified will dynamically change the log level and log format of the component by changing the CR.
logConfig:
# The level field can be used to change the log level of the component. The value can be one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF.
level: "INFO"
# The format field can be used to change the log format of the component. The value can be one of json, text.
format: "text"
# The template field can totally change the log config of the component. The value is a string, which is the content of the log config file.
template: {}

# use a component name that matches your grafana configuration
# so the metrics are correctly rendered in grafana dashboard
component: zookeeper
Expand Down Expand Up @@ -770,6 +781,17 @@ bookkeeper:
# annotations that will be added on the BookKeeperCluster CR only.
annotations: {}

# The field logConfig can be used to change the log level and log format of pods.
# The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml.
# f it is specified will dynamically change the log level and log format of the component by changing the CR.
logConfig:
# The level field can be used to change the log level of the component. The value can be one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF.
level: "INFO"
# The format field can be used to change the log format of the component. The value can be one of json, text.
format: "text"
# The template field can totally change the log config of the component. The value is a string, which is the content of the log config file.
template: {}

# use a component name that matches your grafana configuration
# so the metrics are correctly rendered in grafana dashboard
component: bookie
Expand Down Expand Up @@ -990,6 +1012,17 @@ broker:
# annotations that will be added on the PulsarBroker CR only.
annotations: {}

# The field logConfig can be used to change the log level and log format of pods.
# The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml.
# If it is specified will dynamically change the log level and log format of the component by changing the CR.
logConfig:
# The level field can be used to change the log level of the component. The value can be one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF.
level: "INFO"
# The format field can be used to change the log format of the component. The value can be one of json, text.
format: "text"
# The template field can totally change the log config of the component. The value is a string, which is the content of the log config file.
template: {}

# use a component name that matches your grafana configuration
# so the metrics are correctly rendered in grafana dashboard
component: broker
Expand Down Expand Up @@ -1369,6 +1402,17 @@ proxy:
# annotations that will be added on the PulsarProxy CR only.
annotations: {}

# The field logConfig can be used to change the log level and log format of pods.
# The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml.
# If it is specified will dynamically change the log level and log format of the component by changing the CR.
logConfig:
# The level field can be used to change the log level of the component. The value can be one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF.
level: "INFO"
# The format field can be used to change the log format of the component. The value can be one of json, text.
format: "text"
# The template field can totally change the log config of the component. The value is a string, which is the content of the log config file.
template: {}

# use a component name that matches your grafana configuration
# so the metrics are correctly rendered in grafana dashboard
component: proxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ spec:
replicas: {{ .Values.bookkeeper.replicaCount }}
image: "{{ .Values.images.bookie.repository }}:{{ .Values.images.bookie.tag }}"
imagePullPolicy: {{ .Values.images.bookie.pullPolicy }}
logConfig:
level: {{ .Values.bookkeeper.logConfig.level }}
format: {{ .Values.bookkeeper.logConfig.format }}
{{- with .Values.bookkeeper.logConfig.template }}
template: |
{{- toYaml . | nindent 6 -}}
{{- end }}
pod:
{{- with .Values.bookkeeper.topologySpreadConstraints }}
topologySpreadConstraints:
Expand Down
7 changes: 7 additions & 0 deletions charts/sn-platform/templates/broker/broker-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ spec:
replicas: {{ .Values.broker.replicaCount }}
image: "{{ .Values.images.broker.repository }}:{{ .Values.images.broker.tag }}"
imagePullPolicy: {{ .Values.images.broker.pullPolicy }}
logConfig:
level: {{ .Values.broker.logConfig.level }}
format: {{ .Values.broker.logConfig.format }}
{{- with .Values.broker.logConfig.template }}
template: |
{{- toYaml . | nindent 6 -}}
{{- end }}
pod:
{{- with .Values.broker.topologySpreadConstraints }}
topologySpreadConstraints:
Expand Down
7 changes: 7 additions & 0 deletions charts/sn-platform/templates/proxy/proxy-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ spec:
replicas: {{ .Values.proxy.replicaCount }}
image: "{{ .Values.images.proxy.repository }}:{{ .Values.images.proxy.tag }}"
imagePullPolicy: {{ .Values.images.proxy.pullPolicy }}
logConfig:
level: {{ .Values.proxy.logConfig.level }}
format: {{ .Values.proxy.logConfig.format }}
{{- with .Values.proxy.logConfig.template }}
template: |
{{- toYaml . | nindent 6 -}}
{{- end }}
pod:
{{- with .Values.proxy.topologySpreadConstraints }}
topologySpreadConstraints:
Expand Down
7 changes: 7 additions & 0 deletions charts/sn-platform/templates/zookeeper/zookeeper-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ metadata:
spec:
replicas: {{ .Values.zookeeper.replicaCount }}
image: "{{ .Values.images.zookeeper.repository }}:{{ .Values.images.zookeeper.tag }}"
logConfig:
level: {{ .Values.zookeeper.logConfig.level }}
format: {{ .Values.zookeeper.logConfig.format }}
{{- with .Values.zookeeper.logConfig.template }}
template: |
{{- toYaml . | nindent 6 -}}
{{- end }}
pod:
{{- with .Values.zookeeper.topologySpreadConstraints }}
topologySpreadConstraints:
Expand Down
44 changes: 44 additions & 0 deletions charts/sn-platform/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,17 @@ zookeeper:
# annotations that will be added on the ZooKeeperCluster CR only.
annotations: {}

# The field logConfig can be used to change the log level and log format of pods.
# The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml.
# If it is specified will dynamically change the log level and log format of the component by changing the CR.
logConfig:
# The level field can be used to change the log level of the component. The value can be one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF.
level: "INFO"
# The format field can be used to change the log format of the component. The value can be one of json, text.
format: "text"
# The template field can totally change the log config of the component. The value is a string, which is the content of the log config file.
template: {}

# use a component name that matches your grafana configuration
# so the metrics are correctly rendered in grafana dashboard
component: zookeeper
Expand Down Expand Up @@ -845,6 +856,17 @@ bookkeeper:
# annotations that will be added on the BookKeeperCluster CR only.
annotations: {}

# The field logConfig can be used to change the log level and log format of pods.
# The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml.
# If it is specified will dynamically change the log level and log format of the component by changing the CR.
logConfig:
# The level field can be used to change the log level of the component. The value can be one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF.
level: "INFO"
# The format field can be used to change the log format of the component. The value can be one of json, text.
format: "text"
# The template field can totally change the log config of the component. The value is a string, which is the content of the log config file.
template: {}

# use a component name that matches your grafana configuration
# so the metrics are correctly rendered in grafana dashboard
component: bookie
Expand Down Expand Up @@ -1065,6 +1087,17 @@ broker:
# annotations that will be added on the PulsarBroker CR only.
annotations: {}

# The field logConfig can be used to change the log level and log format of pods.
# The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml.
# If it is specified will dynamically change the log level and log format of the component by changing the CR.
logConfig:
# The level field can be used to change the log level of the component. The value can be one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF.
level: "INFO"
# The format field can be used to change the log format of the component. The value can be one of json, text.
format: "text"
# The template field can totally change the log config of the component. The value is a string, which is the content of the log config file.
template: {}

# use a component name that matches your grafana configuration
# so the metrics are correctly rendered in grafana dashboard
component: broker
Expand Down Expand Up @@ -1444,6 +1477,17 @@ proxy:
# annotations that will be added on the PulsarProxy CR only.
annotations: {}

# The field logConfig can be used to change the log level and log format of pods.
# The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml.
# If it is specified will dynamically change the log level and log format of the component by changing the CR.
logConfig:
# The level field can be used to change the log level of the component. The value can be one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF.
level: "INFO"
# The format field can be used to change the log format of the component. The value can be one of json, text.
format: "text"
# The template field can totally change the log config of the component. The value is a string, which is the content of the log config file.
template: {}

# use a component name that matches your grafana configuration
# so the metrics are correctly rendered in grafana dashboard
component: proxy
Expand Down
67 changes: 67 additions & 0 deletions examples/pulsar-operators/logConfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
apiVersion: pulsar.streamnative.io/v1alpha1
kind: PulsarBroker
metadata:
name: brokers
namespace: default
spec:
image: streamnative/sn-platform-slim:2.10.4.3
# The field logConfig can be used to change the log level and log format of pods.
# The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml.
# If it is specified will dynamically change the log level and log format of the component by changing the CR.
logConfig:
# The level field can be used to change the log level of the component. The value can be one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF.
level: DEBUG
# The format field can be used to change the log format of the component. The value can be one of json, text.
format: json
# The template field can totally change the log config of the component. The value is a string, which is the content of the log config file.
template:
Configuration:
status: INFO
monitorInterval: 30
name: pulsar
packages: io.prometheus.client.log4j2

Properties:
Property:
- name: "pulsar.log.dir"
value: "logs"
- name: "pulsar.log.file"
value: "pulsar.log"
- name: "pulsar.log.immediateFlush"
value: "false"
- name: "pulsar.log.appender"
value: "RoutingAppender"
- name: "pulsar.log.root.level"
value: "info"
- name: "pulsar.log.level"
value: "info"
- name: "pulsar.routing.appender.default"
value: "Console"

pod:
resources:
requests:
cpu: 200m
memory: 512Mi
securityContext:
runAsNonRoot: true
replicas: 2
zkServers: zookeepers-zk:2181
52 changes: 52 additions & 0 deletions examples/sn-platform/logConfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#

broker:
# The field logConfig can be used to change the log level and log format of pods.
# The logConfig field is optional. If it is not specified, the component will use the default log configuration /pulsar/conf/log4j2.yaml.
# If it is specified will dynamically change the log level and log format of the component by changing the CR.
logConfig:
# The level field can be used to change the log level of the component. The value can be one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF.
level: "DEBUG"
# The format field can be used to change the log format of the component. The value can be one of json, text.
format: "json"
# The template field can totally change the log config of the component. The value is a string, which is the content of the log config file.
template:
Configuration:
status: INFO
monitorInterval: 30
name: pulsar
packages: io.prometheus.client.log4j2

Properties:
Property:
- name: "pulsar.log.dir"
value: "logs"
- name: "pulsar.log.file"
value: "pulsar.log"
- name: "pulsar.log.immediateFlush"
value: "false"
- name: "pulsar.log.appender"
value: "RoutingAppender"
- name: "pulsar.log.root.level"
value: "info"
- name: "pulsar.log.level"
value: "info"
- name: "pulsar.routing.appender.default"
value: "Console"

0 comments on commit 8682018

Please sign in to comment.