You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by gy...@apache.org on 2022/02/16 10:34:13 UTC
[flink-kubernetes-operator] 20/23: provide operator log configuration via configmap
This is an automated email from the ASF dual-hosted git repository.
gyfora pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-kubernetes-operator.git
commit b6f369dd54b521fd68e3ce104bd8688a6aae50d0
Author: Matyas Orhidi <ma...@apple.com>
AuthorDate: Fri Feb 11 16:58:17 2022 +0100
provide operator log configuration via configmap
---
docker-entrypoint.sh | 5 +--
helm/flink-operator/templates/flink-operator.yaml | 41 +++++++++++++++++++++--
2 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh
index 94d8f51..813d174 100755
--- a/docker-entrypoint.sh
+++ b/docker-entrypoint.sh
@@ -19,6 +19,7 @@
###############################################################################
args=("$@")
+
if [ "$1" = "help" ]; then
printf "Usage: $(basename "$0") (operator|webhook)\n"
printf " Or $(basename "$0") help\n\n"
@@ -26,11 +27,11 @@ if [ "$1" = "help" ]; then
elif [ "$1" = "operator" ]; then
echo "Starting Operator"
- exec java -jar /$OPERATOR_JAR
+ exec java -jar $LOG_CONFIG /$OPERATOR_JAR
elif [ "$1" = "webhook" ]; then
echo "Starting Webhook"
- exec java -jar /$WEBHOOK_JAR
+ exec java -jar $LOG_CONFIG /$WEBHOOK_JAR
fi
args=("${args[@]}")
diff --git a/helm/flink-operator/templates/flink-operator.yaml b/helm/flink-operator/templates/flink-operator.yaml
index 2123d57..0d1b414 100644
--- a/helm/flink-operator/templates/flink-operator.yaml
+++ b/helm/flink-operator/templates/flink-operator.yaml
@@ -15,7 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
################################################################################
-
---
apiVersion: apps/v1
kind: Deployment
@@ -47,8 +46,12 @@ spec:
env:
- name: FLINK_CONF_DIR
value: /opt/flink/conf
+ - name: LOG_CONFIG
+ value: -Dlog4j.configurationFile=/opt/flink-operator/conf/log4j2.properties
volumeMounts:
- - name: flink-config-volume
+ - name: flink-operator-config-volume
+ mountPath: /opt/flink-operator/conf
+ - name: flink-default-config-volume
mountPath: /opt/flink/conf
{{- if .Values.webhook.create }}
- name: flink-webhook
@@ -73,16 +76,26 @@ spec:
value: "pkcs12"
- name: WEBHOOK_SERVER_PORT
value: "9443"
+ - name: LOG_CONFIG
+ value: -Dlog4j.configurationFile=/opt/flink-operator/conf/log4j2.properties
volumeMounts:
- name: keystore
mountPath: "/certs"
readOnly: true
+ - name: flink-operator-config-volume
+ mountPath: /opt/flink-operator/conf
{{- end }}
volumes:
- - name: flink-config-volume
+ - name: flink-operator-config-volume
configMap:
name: flink-operator-config
items:
+ - key: log4j2.properties
+ path: log4j2.properties
+ - name: flink-default-config-volume
+ configMap:
+ name: flink-default-config
+ items:
- key: flink-conf.yaml
path: flink-conf.yaml
- key: log4j-console.properties
@@ -105,6 +118,28 @@ metadata:
labels:
{{- include "flink-operator.labels" . | nindent 4 }}
data:
+ log4j2.properties: |+
+ rootLogger.level = DEBUG
+ rootLogger.appenderRef.console.ref = ConsoleAppender
+
+ logger.spring-web.name= org.springframework.web.filter
+ logger.spring-web.level = DEBUG
+
+ # Log all infos to the console
+ appender.console.name = ConsoleAppender
+ appender.console.type = CONSOLE
+ appender.console.layout.type = PatternLayout
+ appender.console.layout.pattern = %style{%d}{yellow} %style{%-30c{1.}}{cyan} %highlight{[%-5level] %msg%n%throwable}
+---
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: flink-default-config
+ namespace: {{ .Values.operatorNamespace.name }}
+ labels:
+ {{- include "flink-operator.labels" . | nindent 4 }}
+data:
flink-conf.yaml: |+
taskmanager.numberOfTaskSlots: 2
blob.server.port: 6124