From 58124ffaf8a2cbca69b1e57224239ab8c8a7d6c0 Mon Sep 17 00:00:00 2001 From: "James (Anh-Tu) Nguyen" Date: Wed, 4 Aug 2021 11:49:46 +0800 Subject: [PATCH] BDRK-3386: Update fluentd-container-insight to support containerd logs (#44) * Update fluentd-container-insight to support containerd logs * Add CODEOWNERS * Apply suggestions from code review Co-authored-by: Yong Wen Chua Co-authored-by: Yong Wen Chua --- .github/CODEOWNERS | 4 ++++ charts/eks-container-insights/Chart.yaml | 4 ++-- .../eks-container-insights/templates/configmap.yaml | 12 ++++++------ .../eks-container-insights/templates/daemonset.yaml | 3 +++ charts/eks-container-insights/values.yaml | 9 ++++++++- dockerfiles/eks-container-insights/Dockerfile | 2 +- dockerfiles/fluentd/Dockerfile | 6 +++--- tests/ct.yaml | 2 +- 8 files changed, 28 insertions(+), 14 deletions(-) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..b416acc --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,4 @@ +# Order is important; the last matching pattern takes the most +# precedence. +# https://help.github.com/en/articles/about-code-owners +* @basisai/infrastructure diff --git a/charts/eks-container-insights/Chart.yaml b/charts/eks-container-insights/Chart.yaml index 3845565..c6f0b01 100644 --- a/charts/eks-container-insights/Chart.yaml +++ b/charts/eks-container-insights/Chart.yaml @@ -1,6 +1,6 @@ -apiVersion: v1 +apiVersion: v2 appVersion: "1.0" description: A Helm chart for EKS Container Insights name: eks-container-insights -version: 0.4.1 +version: 0.5.0 home: https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Container-Insights-setup-logs.html diff --git a/charts/eks-container-insights/templates/configmap.yaml b/charts/eks-container-insights/templates/configmap.yaml index c62ae94..bf0d835 100644 --- a/charts/eks-container-insights/templates/configmap.yaml +++ b/charts/eks-container-insights/templates/configmap.yaml @@ -25,8 +25,8 @@ data: tag * read_from_head true - @type json - time_format %Y-%m-%dT%H:%M:%S.%NZ + @type "#{ENV['FLUENT_CONTAINER_TAIL_PARSER_TYPE'] || 'json'}" + time_format "#{ENV['FLUENT_CONTAINER_TAIL_PARSER_TIME_FORMAT'] || '%Y-%m-%dT%H:%M:%S.%NZ'}" @@ -39,8 +39,8 @@ data: tag * read_from_head true - @type json - time_format %Y-%m-%dT%H:%M:%S.%NZ + @type "#{ENV['FLUENT_CONTAINER_TAIL_PARSER_TYPE'] || 'json'}" + time_format "#{ENV['FLUENT_CONTAINER_TAIL_PARSER_TIME_FORMAT'] || '%Y-%m-%dT%H:%M:%S.%NZ'}" @@ -53,8 +53,8 @@ data: tag * read_from_head true - @type json - time_format %Y-%m-%dT%H:%M:%S.%NZ + @type "#{ENV['FLUENT_CONTAINER_TAIL_PARSER_TYPE'] || 'json'}" + time_format "#{ENV['FLUENT_CONTAINER_TAIL_PARSER_TIME_FORMAT'] || '%Y-%m-%dT%H:%M:%S.%NZ'}" diff --git a/charts/eks-container-insights/templates/daemonset.yaml b/charts/eks-container-insights/templates/daemonset.yaml index 784dac1..0284901 100644 --- a/charts/eks-container-insights/templates/daemonset.yaml +++ b/charts/eks-container-insights/templates/daemonset.yaml @@ -71,6 +71,9 @@ spec: value: regional # END Archive cluster logs to S3 {{- end }} + {{- with .Values.env }} + {{- toYaml . | nindent 12 }} + {{- end }} resources: {{- toYaml .Values.resources | nindent 12 }} volumeMounts: diff --git a/charts/eks-container-insights/values.yaml b/charts/eks-container-insights/values.yaml index 7da8c65..5037e65 100644 --- a/charts/eks-container-insights/values.yaml +++ b/charts/eks-container-insights/values.yaml @@ -11,7 +11,7 @@ serviceAccount: annotations: {} image: basisai/eks-container-insights -imageTag: v1.12.4 +imageTag: v1.13.0 initImage: busybox initImageTag: 1.32.0 @@ -39,6 +39,13 @@ additional_container_logs_filters: [] additional_systemd_logs_filters: [] additional_host_logs_filters: [] +env: [] + # Use these variables if containerd runtime + # - name: FLUENT_CONTAINER_TAIL_PARSER_TYPE + # value: "cri" + # - name: FLUENT_CONTAINER_TAIL_PARSER_TIME_FORMAT + # value: "%Y-%m-%dT%H:%M:%S.%N%:z" + resources: limits: cpu: 200m diff --git a/dockerfiles/eks-container-insights/Dockerfile b/dockerfiles/eks-container-insights/Dockerfile index 9f7eff7..73c2f8b 100644 --- a/dockerfiles/eks-container-insights/Dockerfile +++ b/dockerfiles/eks-container-insights/Dockerfile @@ -1,3 +1,3 @@ -FROM fluent/fluentd-kubernetes-daemonset:v1.12.4-debian-cloudwatch-amd64-1.3 +FROM fluent/fluentd-kubernetes-daemonset:v1.13.3-debian-cloudwatch-amd64-1.2 RUN gem install fluent-plugin-s3 -v 1.6.0 --no-document diff --git a/dockerfiles/fluentd/Dockerfile b/dockerfiles/fluentd/Dockerfile index 2d5d898..1c7a8bf 100644 --- a/dockerfiles/fluentd/Dockerfile +++ b/dockerfiles/fluentd/Dockerfile @@ -1,5 +1,5 @@ FROM quay.io/fluentd_elasticsearch/fluentd:v3.2.0 -RUN fluent-gem install digest-crc --version 0.5.1 \ - && fluent-gem install fluent-plugin-gcs --version 0.4.1 \ - && fluent-gem install fluent-plugin-s3 --version 1.6.0 +RUN fluent-gem install digest-crc --version 0.5.1 --no-document \ + && fluent-gem install fluent-plugin-gcs --version 0.4.1 --no-document \ + && fluent-gem install fluent-plugin-s3 --version 1.6.0 --no-document diff --git a/tests/ct.yaml b/tests/ct.yaml index cb4a60d..0a34076 100644 --- a/tests/ct.yaml +++ b/tests/ct.yaml @@ -1,5 +1,5 @@ validate-maintainers: false chart-dirs: -- /charts + - /charts chart-repos: - jetstack=https://charts.jetstack.io