Added seed code for caas-logging.
[ta/caas-logging.git] / ansible / roles / fluentd / templates / fluentd-ds.yaml
diff --git a/ansible/roles/fluentd/templates/fluentd-ds.yaml b/ansible/roles/fluentd/templates/fluentd-ds.yaml
new file mode 100644 (file)
index 0000000..751aaa1
--- /dev/null
@@ -0,0 +1,105 @@
+{#
+Copyright 2019 Nokia
+
+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.
+#}
+---
+apiVersion: apps/v1beta2
+kind: DaemonSet
+metadata:
+  name: fluentd
+  namespace: kube-system
+  labels:
+    {{ caas.kubernetes_component_label }}: fluentd-logging
+    version: v1
+    kubernetes.io/cluster-service: "true"
+spec:
+  selector:
+    matchLabels:
+      {{ caas.kubernetes_component_label }}: fluentd-logging
+  template:
+    metadata:
+      annotations:
+        danm.k8s.io/interfaces: |
+          [
+            {
+              "network":"flannel"
+            }
+          ]
+      labels:
+        {{ caas.kubernetes_component_label }}: fluentd-logging
+        version: v1
+        kubernetes.io/cluster-service: "true"
+    spec:
+      dnsPolicy: ClusterFirst
+      containers:
+      - name: fluentd
+        image: {{ container_image_names | select('search', '/fluentd') | list | last }}
+        command:
+        - "/bin/entrypoint.sh"
+        - "fluentd"
+        - "-c"
+        - "/fluentd/etc/fluent.conf"
+        - "-p"
+        - "/fluentd/plugins"
+        securityContext:
+          capabilities:
+            add:
+              - ALL
+        env:
+          - name:  KUBERNETES_SERVICE_HOST
+            value: "{{ caas.apiserver_service_name }}"
+          - name:  KUBERNETES_SERVICE_PORT
+            value: "{{ caas.apiserver_svc_port }}"
+          - name:  FLUENT_ELASTICSEARCH_HOST
+            value: "{{ caas.elasticsearch_url }}"
+          - name:  FLUENT_ELASTICSEARCH_PORT
+            value: "{{ caas.elasticsearch_port }}"
+          - name: FLUENT_ELASTICSEARCH_SCHEME
+            value: "http"
+          - name: FLUENT_ELASTICSEARCH_USER
+            value: "elastic"
+          - name: FLUENT_ELASTICSEARCH_PASSWORD
+            value: "changeme"
+          - name: FLUENT_ELASTICSEARCH_SSL
+            value: "false"
+          - name: FLUENTD_OPT
+            value: ""
+          # TODO: change it to a dynamic ConfigMap, in case something needs to be run-time configurable
+          - name: FLUENTD_CONF
+            value: "fluent.conf"
+        volumeMounts:
+        - name: varlog
+          mountPath: /var/log
+        - name: varlibdockercontainers
+          mountPath: /var/lib/docker/containers
+        - name: fluentd-secrets
+          mountPath: /etc/fluentd/ssl
+          readOnly: true
+        - name: fluentd-config
+          mountPath: /etc/fluentd/config.d
+      terminationGracePeriodSeconds: 30
+      volumes:
+      - name: varlog
+        hostPath:
+          path: /var/log
+      - name: varlibdockercontainers
+        hostPath:
+          path: /var/lib/docker/containers
+      - name: fluentd-secrets
+        hostPath:
+          path: /etc/fluentd/ssl
+      - name: fluentd-config
+        configMap:
+          name: fluentd-cm
+      serviceAccountName: fluentd