From 45a9fcb975a5482663442735cdc8c197a254bf44 Mon Sep 17 00:00:00 2001 From: Prakarsh Date: Thu, 18 Feb 2021 17:58:23 +0530 Subject: [PATCH] Added Coralogix forked chart --- charts/coralogix/.helmignore | 4 + charts/coralogix/Chart.yaml | 17 + charts/coralogix/LICENSE | 201 ++++++++++++ charts/coralogix/OWNERS | 8 + charts/coralogix/README.md | 101 ++++++ charts/coralogix/templates/NOTES.txt | 7 + charts/coralogix/templates/_helpers.tpl | 16 + charts/coralogix/templates/clusterrole.yaml | 28 ++ .../templates/clusterrolebinding.yaml | 21 ++ charts/coralogix/templates/configmap.yaml | 297 ++++++++++++++++++ charts/coralogix/templates/daemonset.yaml | 74 +++++ charts/coralogix/templates/secret.yaml | 17 + charts/coralogix/templates/service.yaml | 40 +++ .../coralogix/templates/serviceaccount.yaml | 13 + charts/coralogix/values.yaml | 73 +++++ 15 files changed, 917 insertions(+) create mode 100644 charts/coralogix/.helmignore create mode 100644 charts/coralogix/Chart.yaml create mode 100644 charts/coralogix/LICENSE create mode 100644 charts/coralogix/OWNERS create mode 100644 charts/coralogix/README.md create mode 100644 charts/coralogix/templates/NOTES.txt create mode 100644 charts/coralogix/templates/_helpers.tpl create mode 100644 charts/coralogix/templates/clusterrole.yaml create mode 100644 charts/coralogix/templates/clusterrolebinding.yaml create mode 100644 charts/coralogix/templates/configmap.yaml create mode 100644 charts/coralogix/templates/daemonset.yaml create mode 100644 charts/coralogix/templates/secret.yaml create mode 100644 charts/coralogix/templates/service.yaml create mode 100644 charts/coralogix/templates/serviceaccount.yaml create mode 100644 charts/coralogix/values.yaml diff --git a/charts/coralogix/.helmignore b/charts/coralogix/.helmignore new file mode 100644 index 00000000..4b47bff5 --- /dev/null +++ b/charts/coralogix/.helmignore @@ -0,0 +1,4 @@ +OWNERS +.DS_Store +.git +.idea/ diff --git a/charts/coralogix/Chart.yaml b/charts/coralogix/Chart.yaml new file mode 100644 index 00000000..01a392f3 --- /dev/null +++ b/charts/coralogix/Chart.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +name: coralogix-fluentd +version: 1.0.3 +description: Modificated version of official FluentD image with support of integration with Coralogix service. +keywords: + - FluentD + - logging + - Coralogix +home: https://coralogix.com/ +sources: + - https://github.com/coralogix/fluentd-coralogix-image/examples/helm +maintainers: + - name: Eldar Aliiev + email: eldar@coralogix.com + url: https://www.facebook.com/e.aliiev +icon: https://coralogix.com/wp-content/uploads/2016/12/logos_yjmwij-2.png +appVersion: 1.1.6 diff --git a/charts/coralogix/LICENSE b/charts/coralogix/LICENSE new file mode 100644 index 00000000..23caef38 --- /dev/null +++ b/charts/coralogix/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2018 Coralogix Ltd. + + Licensed 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. diff --git a/charts/coralogix/OWNERS b/charts/coralogix/OWNERS new file mode 100644 index 00000000..094594d3 --- /dev/null +++ b/charts/coralogix/OWNERS @@ -0,0 +1,8 @@ +approvers: +- amnons77 +- farin99 +reviewers: +- amnons77 +- oded-dd +- farin99 +- EldarAliiev \ No newline at end of file diff --git a/charts/coralogix/README.md b/charts/coralogix/README.md new file mode 100644 index 00000000..60813a38 --- /dev/null +++ b/charts/coralogix/README.md @@ -0,0 +1,101 @@ +# Coralogix Fluentd Helm chart for Kubernetes + +It's a modificated version of official `FluentD` image with support of integration with *Coralogix*, multiprocessing and K8S. + +## Introduction + +This chart bootstraps a [FluentD Coralogix](https://github.com/coralogix/fluentd-coralogix-image) daemonset on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- `Kubernetes` 1.6+ with Beta APIs enabled + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```bash +$ helm install --name my-release \ + --set PRIVATE_KEY=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX \ + --set APP_NAME=your-app-name \ + --set SUB_SYSTEM=sub-system-name + stable/fluentd-coralogix +``` + +The command deploys *Fluentd-Coralogix* on the `Kubernetes` cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```bash +$ helm delete my-release +``` + +The command removes all the `Kubernetes` components associated with the chart and deletes the release. + +## Configuration + +The following table lists the configurable parameters of the `Fluentd Coralogix` chart and their default values. + +| Parameter | Description | Default | +|--------------------------------------------|----------------------------------------------------------------------------------------------------------------|------------------------------------------------| +| `PRIVATE_KEY` | Coralogix Private Key | `XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX` | +| `APP_NAME` | Coralogix Application Name | `$kubernetes.namespace_name` | +| `SUB_SYSTEM` | Coralogix Subsystem name | `$kubernetes.container_name` | +| `coralogix.log_key_name` | Name of field in record which will be sent to Coralogix | None | +| `coralogix.timestamp_key_name` | Field with will be used in Coralogix as timestamp of log record | None | +| `coralogix.is_json` | Convert data to JSON | `true` | +| `coralogix.force_compression` | Compress data | `false` | +| `coralogix.debug` | Enable debug mode | `false` | +| `coralogix.proxy.host` | Proxy host | `None` | +| `coralogix.proxy.port` | Proxy port | `None` | +| `coralogix.proxy.user` | Proxy user | `None` | +| `coralogix.proxy.password` | Proxy password | `None` | +| `container.image.repository` | Image repository | `docker.io/coralogixrepo/fluentd-coralogix-image` | +| `container.image.tag` | Image tag | `1.1.6` | +| `container.image.pullPolicy` | Image pull policy | `Always` | +| `container.resources.limits.cpu` | CPU resource limits | `100m` | +| `container.resources.limits.memory` | Memory resource limits | `400Mi` | +| `container.resources.requests.cpu` | CPU resource requests | `100m` | +| `container.resources.requests.memory` | Memory resource requests | `400Mi` | +| `rbac.create` | If `true`, create and use RBAC resources | `false` | +| `tolerations` | List of node taints to tolerate (requires Kubernetes >= 1.6) | `node-role.kubernetes.io/master`: `NoSchedule` | +| `service.fluentd.enabled` | Enable FluentD forward service | `true` | +| `service.fluentd.port` | FluentD port | `24224` | +| `service.http.enabled` | Enable HTTP collector service | `true` | +| `service.http.port` | HTTP port | `9880` | +| `service.syslog.enabled` | Enable Syslog collector service | `true` | +| `service.syslog.port` | Syslog port | `5140` | +| `service.graylog.enabled` | Enable Graylog collector service | `true` | +| `service.graylog.port` | Graylog port | `12201` | +| `service.clusterIP` | ClusterIP for service enabled | `None` | + + +### RBAC + +By default the chart will not install the associated RBAC rolebinding, +using beta annotations. + +To determine if your cluster supports this running the following: + +```console +$ kubectl api-versions | grep rbac +``` + +You also need to have the following parameter on the api server. See the +following document for how to enable [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/). + +``` +--authorization-mode=RBAC +``` + +If the output contains `"beta"` or both `"alpha"` and `"beta"` you can enable RBAC. + +### Enable RBAC role/rolebinding creation + +To enable the creation of RBAC resources, do the following: + +```console +$ helm install --name my-release stable/fluentd-coralogix --set rbac.create=true ... +``` diff --git a/charts/coralogix/templates/NOTES.txt b/charts/coralogix/templates/NOTES.txt new file mode 100644 index 00000000..d3935c19 --- /dev/null +++ b/charts/coralogix/templates/NOTES.txt @@ -0,0 +1,7 @@ +Thanks for installing Coralogix FluentD logger. +Please visit {{ .Chart.Home }} for more information. + +Usage manual you can find here: +https://github.com/coralogix/fluentd-coralogix-image/blob/master/examples/helm/README.md + +Version: {{ .Chart.Version }} \ No newline at end of file diff --git a/charts/coralogix/templates/_helpers.tpl b/charts/coralogix/templates/_helpers.tpl new file mode 100644 index 00000000..f1292348 --- /dev/null +++ b/charts/coralogix/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "coralogix-fluentd.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "coralogix-fluentd.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-logger" $name | trunc 63 | trimSuffix "-" }} +{{- end -}} \ No newline at end of file diff --git a/charts/coralogix/templates/clusterrole.yaml b/charts/coralogix/templates/clusterrole.yaml new file mode 100644 index 00000000..c4b5510c --- /dev/null +++ b/charts/coralogix/templates/clusterrole.yaml @@ -0,0 +1,28 @@ +{{- if .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ template "coralogix-fluentd.name" . }}-service-account-role + namespace: kube-system + labels: + k8s-app: {{ template "coralogix-fluentd.fullname" . }} + k8s-app-version: {{ .Chart.AppVersion }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +rules: + # Allow FluentD-Coralogix-Logger to get 'fluentd-coralogix-account-secrets' secret. +- apiGroups: [""] + resources: ["secrets"] + resourceNames: ["{{ template "coralogix-fluentd.name" . }}-account-secrets"] + verbs: ["get"] + # Allow FluentD-Coralogix-Logger to get 'fluentd-coralogix-configs' config map. +- apiGroups: [""] + resources: ["configmaps"] + resourceNames: ["{{ template "coralogix-fluentd.name" . }}-configs"] + verbs: ["get"] + # Allow FluentD-Coralogix-Logger to get cluster info. +- apiGroups: [""] + resources: ["namespaces", "pods"] + verbs: ["get", "list", "watch"] +{{- end }} diff --git a/charts/coralogix/templates/clusterrolebinding.yaml b/charts/coralogix/templates/clusterrolebinding.yaml new file mode 100644 index 00000000..cc5eea6d --- /dev/null +++ b/charts/coralogix/templates/clusterrolebinding.yaml @@ -0,0 +1,21 @@ +{{- if .Values.rbac.create }} +apiVersion: {{ .Values.rbacapiversion }} +kind: ClusterRoleBinding +metadata: + name: {{ template "coralogix-fluentd.name" . }}-service-account + namespace: kube-system + labels: + k8s-app: {{ template "coralogix-fluentd.fullname" . }} + k8s-app-version: {{ .Chart.AppVersion }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ template "coralogix-fluentd.name" . }}-service-account-role +subjects: +- kind: ServiceAccount + name: {{ template "coralogix-fluentd.name" . }}-service-account + namespace: kube-system +{{- end }} diff --git a/charts/coralogix/templates/configmap.yaml b/charts/coralogix/templates/configmap.yaml new file mode 100644 index 00000000..7be97778 --- /dev/null +++ b/charts/coralogix/templates/configmap.yaml @@ -0,0 +1,297 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: {{ template "coralogix-fluentd.name" . }}-configs + namespace: kube-system + labels: + k8s-app: {{ template "coralogix-fluentd.fullname" . }} + k8s-app-version: {{ .Chart.AppVersion }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: + fluent.conf: | + @include conf/*.conf + kubernetes.conf: | + + @id minion + @type tail + @label @KUBERNETES_CLUSTER_COMPONENTS + path /var/log/salt/minion + pos_file /var/log/salt.pos + + @type regexp + expression /^(? + tag salt + + + @id startupscript.log + @type tail + @label @KUBERNETES_CLUSTER_COMPONENTS + path /var/log/startupscript.log + pos_file /var/log/startupscript.log.pos + + @type syslog + message_format auto + + tag startupscript + + + @id docker.log + @type tail + @label @KUBERNETES_CLUSTER_COMPONENTS + path /var/log/docker.log + pos_file /var/log/docker.log.pos + + @type regexp + expression /^time="(? + tag docker + + + @id etcd.log + @type tail + @label @KUBERNETES_CLUSTER_COMPONENTS + path /var/log/etcd.log + pos_file /var/log/etcd.log.pos + + @type none + + tag etcd + + + @id kubelet.log + @type tail + @label @KUBERNETES_CLUSTER_COMPONENTS + path /var/log/kubelet.log + pos_file /var/log/kubelet.log.pos + + @type kubernetes + + multiline_flush_interval 5s + tag kubelet + + + @id kube-proxy.log + @type tail + @label @KUBERNETES_CLUSTER_COMPONENTS + path /var/log/kube-proxy.log + pos_file /var/log/kube-proxy.log.pos + + @type kubernetes + + multiline_flush_interval 5s + tag kube-proxy + + + @id kube-apiserver.log + @type tail + @label @KUBERNETES_CLUSTER_COMPONENTS + path /var/log/kube-apiserver.log + pos_file /var/log/kube-apiserver.log.pos + + @type kubernetes + + multiline_flush_interval 5s + tag kube-apiserver + + + @id kube-controller-manager.log + @type tail + @label @KUBERNETES_CLUSTER_COMPONENTS + path /var/log/kube-controller-manager.log + pos_file /var/log/kube-controller-manager.log.pos + + @type kubernetes + + multiline_flush_interval 5s + tag kube-controller-manager + + + @id kube-scheduler.log + @type tail + @label @KUBERNETES_CLUSTER_COMPONENTS + path /var/log/kube-scheduler.log + pos_file /var/log/kube-scheduler.log.pos + + @type kubernetes + + multiline_flush_interval 5s + tag kube-scheduler + + + @id rescheduler.log + @type tail + @label @KUBERNETES_CLUSTER_COMPONENTS + path /var/log/rescheduler.log + pos_file /var/log/rescheduler.log.pos + + @type kubernetes + + multiline_flush_interval 5s + tag rescheduler + + + @id glbc.log + @type tail + @label @KUBERNETES_CLUSTER_COMPONENTS + path /var/log/glbc.log + pos_file /var/log/glbc.log.pos + + @type kubernetes + + multiline_flush_interval 5s + tag glbc + + + @id cluster-autoscaler.log + @type tail + @label @KUBERNETES_CLUSTER_COMPONENTS + path /var/log/cluster-autoscaler.log + pos_file /var/log/cluster-autoscaler.log.pos + + @type kubernetes + + multiline_flush_interval 5s + tag cluster-autoscaler + + + + @id fluentd-containers.log + @type tail + @label @KUBERNETES_CONTAINERS + path /var/log/containers/*.log + pos_file /var/log/containers.log.pos + tag raw.containers.* + read_from_head true + + @type multi_format + + format json + time_key time + time_format %Y-%m-%dT%H:%M:%S.%NZ + keep_time_key true + + + format /^(? + + + diff --git a/charts/coralogix/templates/daemonset.yaml b/charts/coralogix/templates/daemonset.yaml new file mode 100644 index 00000000..8771f468 --- /dev/null +++ b/charts/coralogix/templates/daemonset.yaml @@ -0,0 +1,74 @@ +apiVersion: {{ .Values.daemonsetapiversion }} +kind: DaemonSet +metadata: + name: {{ template "coralogix-fluentd.name" . }}-daemonset + namespace: kube-system + labels: + k8s-app: {{ template "coralogix-fluentd.fullname" . }} + k8s-app-version: {{ .Chart.AppVersion }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + kubernetes.io/cluster-service: "true" +spec: + selector: + matchLabels: + k8s-app: {{ template "coralogix-fluentd.fullname" . }} + template: + metadata: + labels: + k8s-app: {{ template "coralogix-fluentd.fullname" . }} + k8s-app-version: {{ .Chart.AppVersion }} + kubernetes.io/cluster-service: "true" + spec: + containers: + - name: fluentd-coralogix + image: {{ .Values.container.image.repository }}:{{ .Values.container.image.tag }} + imagePullPolicy: {{ .Values.container.image.pullPolicy }} + ports: + - containerPort: 24224 + protocol: TCP + name: fluentd + - containerPort: 9880 + protocol: TCP + name: http + - containerPort: 5140 + protocol: UDP + name: syslog + - containerPort: 12201 + protocol: UDP + name: graylog + envFrom: + - secretRef: + name: {{ template "coralogix-fluentd.name" . }}-account-secrets + resources: +{{ toYaml .Values.container.resources | indent 10 }} + volumeMounts: + - name: varlog + mountPath: /var/log + - name: varlibdockercontainers + mountPath: /var/lib/docker/containers + readOnly: true + - name: fluentd-config + mountPath: /fluentd/etc/fluent.conf + subPath: fluent.conf + - name: fluentd-config + mountPath: /fluentd/etc/conf/kubernetes.conf + subPath: kubernetes.conf + terminationGracePeriodSeconds: 30 + volumes: + - name: varlog + hostPath: + path: /var/log + - name: varlibdockercontainers + hostPath: + path: /var/lib/docker/containers + - name: fluentd-config + configMap: + name: {{ template "coralogix-fluentd.name" . }}-configs + {{- if .Values.rbac.create }} + serviceAccount: {{ template "coralogix-fluentd.name" . }}-service-account + serviceAccountName: {{ template "coralogix-fluentd.name" . }}-service-account + {{- end }} + tolerations: +{{ toYaml .Values.tolerations | indent 8 }} diff --git a/charts/coralogix/templates/secret.yaml b/charts/coralogix/templates/secret.yaml new file mode 100644 index 00000000..24e8a59a --- /dev/null +++ b/charts/coralogix/templates/secret.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "coralogix-fluentd.name" . }}-account-secrets + namespace: kube-system + labels: + k8s-app: {{ template "coralogix-fluentd.fullname" . }} + k8s-app-version: {{ .Chart.AppVersion }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +data: + PRIVATE_KEY: {{ .Values.PRIVATE_KEY | b64enc | quote }} + APP_NAME: {{ .Values.APP_NAME | b64enc | quote }} + SUB_SYSTEM: {{ .Values.SUB_SYSTEM | b64enc | quote }} + CORALOGIX_TIME_DELTA_URL: {{ .Values.CORALOGIX_TIME_DELTA_URL | b64enc | quote }} + CORALOGIX_LOG_URL: {{ .Values.CORALOGIX_LOG_URL | b64enc | quote }} \ No newline at end of file diff --git a/charts/coralogix/templates/service.yaml b/charts/coralogix/templates/service.yaml new file mode 100644 index 00000000..4512765f --- /dev/null +++ b/charts/coralogix/templates/service.yaml @@ -0,0 +1,40 @@ +kind: Service +apiVersion: v1 +metadata: + name: {{ template "coralogix-fluentd.name" . }}-service + namespace: kube-system + labels: + k8s-app: {{ template "coralogix-fluentd.fullname" . }} + k8s-app-version: {{ .Chart.AppVersion }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + selector: + k8s-app: {{ template "coralogix-fluentd.fullname" . }} + ports: + {{- if .Values.service.fluentd.enabled }} + - port: {{ .Values.service.fluentd.port }} + targetPort: 24224 + protocol: TCP + name: fluentd + {{- end }} + {{- if .Values.service.http.enabled }} + - port: {{ .Values.service.http.port }} + targetPort: 9880 + protocol: TCP + name: http + {{- end }} + {{- if .Values.service.syslog.enabled }} + - port: {{ .Values.service.syslog.port }} + targetPort: 5140 + protocol: UDP + name: syslog + {{- end }} + {{- if .Values.service.graylog.enabled }} + - port: {{ .Values.service.graylog.port }} + targetPort: 12201 + protocol: UDP + name: graylog + {{- end }} + clusterIP: {{ .Values.service.clusterIP }} \ No newline at end of file diff --git a/charts/coralogix/templates/serviceaccount.yaml b/charts/coralogix/templates/serviceaccount.yaml new file mode 100644 index 00000000..cedde893 --- /dev/null +++ b/charts/coralogix/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.rbac.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "coralogix-fluentd.name" . }}-service-account + namespace: kube-system + labels: + k8s-app: {{ template "coralogix-fluentd.fullname" . }} + k8s-app-version: {{ .Chart.AppVersion }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- end }} diff --git a/charts/coralogix/values.yaml b/charts/coralogix/values.yaml new file mode 100644 index 00000000..bd3703f6 --- /dev/null +++ b/charts/coralogix/values.yaml @@ -0,0 +1,73 @@ +## Coralogix Account secrets +PRIVATE_KEY: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX +APP_NAME: $kubernetes.namespace_name +SUB_SYSTEM: $kubernetes.container_name +CORALOGIX_LOG_URL: https://api.app.coralogix.in/api/v1/logs +CORALOGIX_TIME_DELTA_URL: https://api.app.coralogix.in/sdk/v1/time + +#Daemonset apiversion for K8s < v1.16 +daemonsetapiversion: extensions/v1beta1 +# For K8s v1.16+ +#daemonsetapiversion: apps/v1 + + +## Coralogix output settings +coralogix: + # log_key_name: "" + # timestamp_key_name: "" + is_json: true + force_compression: false + debug: false + proxy: {} + # host: localhost + # port: 3128 + # user: root + # password: strong_pass + +## Pod settings +container: + image: + repository: docker.io/coralogixrepo/fluentd-coralogix-image + tag: 1.1.6 + pullPolicy: Always + resources: + limits: + cpu: 100m + memory: 400Mi + requests: + cpu: 100m + memory: 400Mi + +## Security settings +rbac: + create: false +#rbac api version +rbacapiversion: rbac.authorization.k8s.io/v1 + +## Node settings +tolerations: + - key: node-role.kubernetes.io/master + effect: NoSchedule + +## FluentD service settings +service: + fluentd: + enabled: true + port: 24224 + http: + enabled: true + port: 9880 + syslog: + enabled: true + port: 5140 + graylog: + enabled: true + port: 12201 + clusterIP: None +customfilters: | +# +# @type concat +# key log +# @type concat +# flush_interval 30 +#