如何使用 Helm Chart 部署配置模式注册表映像的记录器

How to configure the logger of schema registry image with helm chart deployment

我使用架构注册表 5.4 - https://hub.docker.com/r/confluentinc/cp-schema-registry/, and use helm chart https://github.com/helm/charts/tree/master/incubator/schema-registry 进行部署。

为了设置我的记录器,我创建了一个 configmap 并将其安装到使用图像的模式注册表容器 -confluentinc/cp-schema-registry:5.4.0

apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "schema-registry.fullname" . }}-log4j-configmap
  labels:
    app: {{ template "schema-registry.name" . }}
    chart: {{ template "schema-registry.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
data:
  log4j.properties: |+
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.encoding=UTF-8

但是不知道容器的命令里面应该改什么,或者有一个指向log4j.properties的变量来设置? 例如,我打算像下面这样更改命令:

command:
- java
- -Dlog4j.configuration=file:/etc/schema-registry-log4j/log4j.properties
- -jar
- schema-registry.jar

选项 1:

我发现的一种方法是使用 FROM 构建一个新图像并将我的自定义 log4j 属性放在那里。

https://docs.confluent.io/current/installation/docker/development.html#log-to-external-volumes

选项 2: 另一种方式是设置环境变量

SCHEMA_REGISTRY_LOG4J_LOGGERS="org.apache.kafka=ERROR,io.confluent.rest.exceptions=FATAL"