-
Notifications
You must be signed in to change notification settings - Fork 459
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
Change horizontal pod autoscaler to use otelcol scale subresource #941
Changes from 23 commits
c5f0e1d
04abf43
e6e73da
6ba5e93
23d00f0
949a29f
f088fea
34f44f7
4974844
88575f6
1d45856
2149091
dc55641
36d2dda
41b581a
c22f6b4
b4a72d1
33d9c48
2f5ade5
0bc348b
3ce81aa
aeb4a97
96917a2
2ef9467
ba0423b
ef318ef
27fb26f
c733b6e
81aa971
f3d190b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,6 +223,10 @@ spec: | |
If MaxReplicas is set autoscaling is enabled. | ||
format: int32 | ||
type: integer | ||
minReplicas: | ||
description: MinReplicas sets a lower bound to the autoscaling feature. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add here the lowest value? |
||
format: int32 | ||
type: integer | ||
mode: | ||
description: Mode represents how the collector should be deployed | ||
(deployment, daemonset, statefulset or sidecar) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,6 +221,10 @@ spec: | |
If MaxReplicas is set autoscaling is enabled. | ||
format: int32 | ||
type: integer | ||
minReplicas: | ||
description: MinReplicas sets a lower bound to the autoscaling feature. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please add here the lowest value? |
||
format: int32 | ||
type: integer | ||
mode: | ||
description: Mode represents how the collector should be deployed | ||
(deployment, daemonset, statefulset or sidecar) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1455,6 +1455,15 @@ OpenTelemetryCollectorSpec defines the desired state of OpenTelemetryCollector. | |
<i>Format</i>: int32<br/> | ||
</td> | ||
<td>false</td> | ||
</tr><tr> | ||
<td><b>minReplicas</b></td> | ||
<td>integer</td> | ||
<td> | ||
MinReplicas sets a lower bound to the autoscaling feature.<br/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also here. |
||
<br/> | ||
<i>Format</i>: int32<br/> | ||
</td> | ||
<td>false</td> | ||
</tr><tr> | ||
<td><b>mode</b></td> | ||
<td>enum</td> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
# Install metrics-server on kind clusters for autoscale tests. Note: This is not needed for minikube, | ||
# you can just add --addons "metrics-server" to the start command. | ||
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml | ||
kubectl patch deployment -n kube-system metrics-server --type "json" -p '[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": --kubelet-insecure-tls}]' | ||
kubectl wait --for=condition=available deployment/metrics-server -n kube-system --timeout=5m |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,7 @@ func TestExpectedHPA(t *testing.T) { | |
maxReplicas := int32(3) | ||
updateParms := paramsWithHPA() | ||
updateParms.Instance.Spec.Replicas = &minReplicas | ||
updateParms.Instance.Spec.Replicas = &minReplicas | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please fix this duplicated code. |
||
updateParms.Instance.Spec.MaxReplicas = &maxReplicas | ||
updatedHPA := collector.HorizontalPodAutoscaler(updateParms.Config, logger, updateParms.Instance) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: simplest-collector | ||
status: | ||
readyReplicas: 1 | ||
|
||
--- | ||
apiVersion: autoscaling/v1 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: simplest-collector | ||
spec: | ||
minReplicas: 1 | ||
maxReplicas: 2 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: OpenTelemetryCollector | ||
metadata: | ||
name: simplest | ||
spec: | ||
replicas: 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this field be automatically filled, once the minReplicas is the default lower bound of that instance? |
||
minReplicas: 1 | ||
maxReplicas: 2 | ||
resources: | ||
limits: | ||
cpu: 500m | ||
memory: 128Mi | ||
requests: | ||
cpu: 5m | ||
memory: 64Mi | ||
|
||
config: | | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
http: | ||
processors: | ||
|
||
exporters: | ||
logging: | ||
|
||
service: | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: [] | ||
exporters: [logging] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: tracegen | ||
status: | ||
conditions: | ||
- status: "True" | ||
type: Complete | ||
|
||
--- | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: OpenTelemetryCollector | ||
|
||
metadata: | ||
name: simplest | ||
status: | ||
scale: | ||
replicas: 2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: tracegen | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: tracegen | ||
image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/tracegen:latest | ||
command: | ||
- "./tracegen" | ||
args: | ||
- -otlp-endpoint=simplest-collector-headless:4317 | ||
- -otlp-insecure | ||
- -duration=1m | ||
- -workers=20 | ||
restartPolicy: Never | ||
backoffLimit: 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if we can change the CRD. In this case, a field is removed.