Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HorizontalPodAutoscaler for fluentd #339

Merged
merged 25 commits into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7f119fe
add prometheus adapter helm chart dependency
vsinghal13 Dec 11, 2019
169df02
add autoscaling config in values.yaml
vsinghal13 Dec 11, 2019
56d4fff
add template for hpa.yaml
vsinghal13 Dec 11, 2019
c2f5225
fix indentation in requirements.yaml
vsinghal13 Dec 11, 2019
189f678
Generate new 'fluentd-sumologic.yaml.tmpl'
Dec 12, 2019
f63f2bc
change HPA config to use custom metric
vsinghal13 Dec 12, 2019
80ea24d
Merge branch 'vsinghal-fluentd-autoscaler' of https://github.com/Sumo…
vsinghal13 Dec 12, 2019
0dc2207
Generate new 'fluentd-sumologic.yaml.tmpl'
Dec 12, 2019
0eee516
Generate new overrides yaml/libsonnet file(s).
Dec 12, 2019
a7c3da0
change apiVersion
vsinghal13 Dec 12, 2019
c95fa2a
use CPU as the metrics for HPA
vsinghal13 Dec 13, 2019
0c29e1d
Merge branch 'vsinghal-fluentd-autoscaler' of https://github.com/Sumo…
vsinghal13 Dec 13, 2019
61f1714
Generate new 'fluentd-sumologic.yaml.tmpl'
Dec 13, 2019
773ac58
Generate new overrides yaml/libsonnet file(s).
Dec 13, 2019
2f12518
simplify hpa.yaml
vsinghal13 Dec 13, 2019
be04863
Generate new 'fluentd-sumologic.yaml.tmpl'
Dec 13, 2019
6f9e198
Generate new overrides yaml/libsonnet file(s).
Dec 13, 2019
f6d419c
address PR comments
vsinghal13 Dec 13, 2019
e43cae5
Merge branch 'vsinghal-fluentd-autoscaler' of https://github.com/Sumo…
vsinghal13 Dec 13, 2019
75a695c
default the autoscaler config to false
vsinghal13 Dec 17, 2019
6fde744
Change CI
vsinghal13 Dec 17, 2019
4b4b6a6
Generate new 'fluentd-sumologic.yaml.tmpl'
Dec 17, 2019
030126d
add git diff command for metrics-server-overrides.yaml
vsinghal13 Dec 17, 2019
12c5c71
Merge branch 'vsinghal-fluentd-autoscaler' of https://github.com/Sumo…
vsinghal13 Dec 17, 2019
8903708
add metrics-server-overrides.yaml
vsinghal13 Dec 17, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ if [ -n "$GITHUB_TOKEN" ] && [ "$TRAVIS_EVENT_TYPE" == "pull_request" ]; then
# Generate override yaml files for chart dependencies to determine if changes are made to overrides yaml files
echo "Generating overrides files..."

metrics_server_start=`grep -n "metrics-server:" deploy/helm/sumologic/values.yaml | head -n 1 | cut -d: -f1`
metrics_server_start=$(($metrics_server_start + 2))
metrics_server_end=`grep -n "## Configure fluent-bit" deploy/helm/sumologic/values.yaml | head -n 1 | cut -d: -f1`
metrics_server_end=$(($metrics_server_end - 1))

echo "Copy 'values.yaml' from line $metrics_server_start to line $metrics_server_end to 'metrics-server-overrides.yaml'"
echo "# This file is auto-generated." > deploy/helm/metrics-server-overrides.yaml
# Copy lines of metrics_server section and remove indention from values.yaml
sed -n "$metrics_server_start,${metrics_server_end}p" deploy/helm/sumologic/values.yaml | sed 's/ //' >> deploy/helm/metrics-server-overrides.yaml

fluent_bit_start=`grep -n "fluent-bit:" deploy/helm/sumologic/values.yaml | head -n 1 | cut -d: -f1`
fluent_bit_start=$(($fluent_bit_start + 2))
fluent_bit_end=`grep -n "## Configure prometheus-operator" deploy/helm/sumologic/values.yaml | head -n 1 | cut -d: -f1`
Expand Down Expand Up @@ -149,7 +159,7 @@ if [ -n "$GITHUB_TOKEN" ] && [ "$TRAVIS_EVENT_TYPE" == "pull_request" ]; then
# Copy lines of falco section and remove indention from values.yaml
sed -n "$falco_start,$ p" deploy/helm/sumologic/values.yaml | sed 's/ //' >> deploy/helm/falco-overrides.yaml

if [ "$(git diff deploy/helm/fluent-bit-overrides.yaml)" ] || [ "$(git diff deploy/helm/prometheus-overrides.yaml)" ] || [ "$(git diff deploy/helm/falco-overrides.yaml)" ] || [ "$(git diff deploy/kubernetes/kube-prometheus-sumo-logic-mixin.libsonnet)" ]; then
if [ "$(git diff deploy/helm/metrics-server-overrides.yaml)" ] || [ "$(git diff deploy/helm/fluent-bit-overrides.yaml)" ] || [ "$(git diff deploy/helm/prometheus-overrides.yaml)" ] || [ "$(git diff deploy/helm/falco-overrides.yaml)" ] || [ "$(git diff deploy/kubernetes/kube-prometheus-sumo-logic-mixin.libsonnet)" ]; then
echo "Detected changes in 'fluent-bit-overrides.yaml', 'prometheus-overrides.yaml', 'falco-overrides.yaml', or 'kube-prometheus-sumo-logic-mixin.libsonnet', committing the updated version to $TRAVIS_PULL_REQUEST_BRANCH..."
git add deploy/helm/*-overrides.yaml
git add deploy/kubernetes/kube-prometheus-sumo-logic-mixin.libsonnet
Expand Down
5 changes: 5 additions & 0 deletions deploy/helm/metrics-server-overrides.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is auto-generated.
args:
- --kubelet-insecure-tls
- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname

4 changes: 4 additions & 0 deletions deploy/helm/sumologic/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ dependencies:
version: 1.0.9
repository: https://kubernetes-charts.storage.googleapis.com/
condition: falco.enabled
- name: metrics-server
version: 2.7.0
repository: https://kubernetes-charts.storage.googleapis.com/
condition: metrics-server.enabled
17 changes: 17 additions & 0 deletions deploy/helm/sumologic/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- if .Values.sumologic.fluentd.autoscaling.enabled}}
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "sumologic.fullname" . }}
labels:
app: {{ template "sumologic.labels.app" . }}
{{- include "sumologic.labels.common" . | nindent 4 }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "sumologic.fullname" . }}
minReplicas: {{ .Values.sumologic.fluentd.autoscaling.minReplicas }}
maxReplicas: {{ .Values.sumologic.fluentd.autoscaling.maxReplicas }}
targetCPUUtilizationPercentage: {{ .Values.sumologic.fluentd.autoscaling.targetCPUUtilizationPercentage }}
{{- end -}}
15 changes: 15 additions & 0 deletions deploy/helm/sumologic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ sumologic:
fluentd:
## Option to specify the Fluentd buffer as file/memory.
buffer: "memory"
## Option to turn autoscaling on for fluentd and specify metrics for HPA.
autoscaling:
enabled: false

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vsinghal13 will autoscaling be OFF by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, by default it will be off as of now.

minReplicas: 3
maxReplicas: 10
targetCPUUtilizationPercentage: 50

k8sMetadataFilter:
## Option to control the enabling of metadata filter plugin watch.
Expand All @@ -181,6 +187,15 @@ sumologic:
## ref: https://github.com/fabric8io/fluent-plugin-kubernetes_metadata_filter#configuration
bearerCacheTtl: "3600"


## Configure metrics-server
## ref: https://github.com/helm/charts/blob/master/stable/metrics-server/values.yaml
metrics-server:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to teach our CI to generate metrics-server-overrides.yaml for the non-Helm installation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it will be required if we want to add the arguments.

enabled: true
args:
- --kubelet-insecure-tls
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could see customers having an issue with using this in an insecure way. Is there any other way to run this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without using that the metrics server is unable to get metrics. Will look into it more if we can avoid this.
kubernetes-sigs/metrics-server#131

- --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname

## Configure fluent-bit
## ref: https://github.com/helm/charts/blob/master/stable/fluent-bit/values.yaml
fluent-bit:
Expand Down
3 changes: 3 additions & 0 deletions deploy/kubernetes/fluentd-sumologic.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -656,3 +656,6 @@ spec:
value: "100k"
- name: TOTAL_LIMIT_SIZE
value: "128m"
---
# Source: sumologic/templates/hpa.yaml