diff --git a/helm/fluentd.yaml b/helm/fluentd.yaml new file mode 100644 index 0000000..07c7326 --- /dev/null +++ b/helm/fluentd.yaml @@ -0,0 +1,29 @@ +fluentd: + enabled: true + forwarder: + initContainers: + - name: fluentd-init + image: busybox + command: ['/bin/sh', '-c', 'until nc -z exam-fluentd-0.exam-fluentd-headless.exam.svc.cluster.local ${EXAM_FLUENTD_AGGREGATOR_SERVICE_PORT_TCP-24224}; do sleep 5; done;'] + configMapFiles: + fluentd-inputs.conf: | + + @type http + port 9880 + + + @type tail + path /var/log/containers/exam-*.log + exclude_path /var/log/containers/*fluentd*.log + pos_file /opt/bitnami/fluentd/logs/buffers/fluentd-docker.pos + tag kubernetes.* + read_from_head true + + @type json + time_key time + time_format %Y-%m-%dT%H:%M:%S.%NZ + + + + @type kubernetes_metadata + \ No newline at end of file diff --git a/helm/values.yaml b/helm/values.yaml index 82949ac..3182fc1 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -101,31 +101,4 @@ deployments: command: ['/bin/sh', '-c', 'exec pg_isready -U "$POSTGRES_USER" -h 127.0.0.1 -p "${EXAM_DB_SERVICE_PORT-5432}";'] fluentd: - enabled: true - forwarder: - initContainers: - - name: fluentd-init - image: busybox - command: ['/bin/sh', '-c', 'until nc -z exam-fluentd-0.exam-fluentd-headless.exam.svc.cluster.local ${EXAM_FLUENTD_AGGREGATOR_SERVICE_PORT_TCP-24224}; do sleep 5; done;'] - configMapFiles: - fluentd-inputs.conf: | - - @type http - port 9880 - - - @type tail - path /var/log/containers/exam-*.log - exclude_path /var/log/containers/*fluentd*.log - pos_file /opt/bitnami/fluentd/logs/buffers/fluentd-docker.pos - tag kubernetes.* - read_from_head true - - @type json - time_key time - time_format %Y-%m-%dT%H:%M:%S.%NZ - - - - @type kubernetes_metadata - \ No newline at end of file + enabled: false \ No newline at end of file diff --git a/run.sh b/run.sh index b5163f9..dc29968 100755 --- a/run.sh +++ b/run.sh @@ -9,13 +9,15 @@ interactive=false postgres_version= enable_ssl= api_replicas= +fluentd=false -while getopts "ihp:s:r:" arg; do +while getopts "ifhp:s:r:" arg; do case $arg in i) interactive=true ;; p) postgres_version=${OPTARG} ;; s) enable_ssl=${OPTARG} ;; r) api_replicas=${OPTARG} ;; + f) fluentd=true ;; *) usage ;; esac done @@ -74,4 +76,11 @@ fi $START_MINIKUBE && minikube addons enable ingress -helm status exam -n exam > /dev/null 2>&1 && helm upgrade exam ./helm -n exam || helm install exam ./helm -n exam +helm dependency build helm + +if [ "$fluentd" == true ]; then + VALUES=("-f" "helm/values.yaml" "-f" "helm/fluentd.yaml") + helm status exam -n exam > /dev/null 2>&1 && helm upgrade exam ./helm -n exam ${VALUES[@]} || helm install exam ./helm -n exam ${VALUES[@]} +else + helm status exam -n exam > /dev/null 2>&1 && helm upgrade exam ./helm -n exam || helm install exam ./helm -n exam +fi \ No newline at end of file