-
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
Closed
kevinearls
wants to merge
30
commits into
open-telemetry:main
from
kevinearls:hpa-use-scale-subresource
Closed
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
c5f0e1d
Change horizontal pod autoscaler to use otelcol scale subresource
kevinearls 04abf43
Fix name
kevinearls e6e73da
Change horizontal pod autoscaler to use otelcol scale subresource
kevinearls 6ba5e93
Fix name
kevinearls 23d00f0
Merge branch 'hpa-use-scale-subresource' of github.com:kevinearls/ope…
kevinearls 949a29f
Moved autoscale values into their own spec, added scale up test
kevinearls f088fea
Added a period to a comment to make the linter stop complaining
kevinearls 34f44f7
Reran make generate after linting
kevinearls 4974844
Fix autoscale test
kevinearls 88575f6
Updated to autoscaling/v2beta2 as v1 is not available in k8s 1.24
kevinearls 1d45856
Install metrics-server on kind clusters for autoscale tests
kevinearls 2149091
Merge branch 'main' into hpa-use-scale-subresource
kevinearls dc55641
Fix more lint complaints
kevinearls 36d2dda
Only scale up to 5 replicas in test
kevinearls 41b581a
Fix test
kevinearls c22f6b4
Update test so it will work correctly in CI
kevinearls b4a72d1
Revert to autoscaling v1
kevinearls 33d9c48
Reduce maxReplicas count to get kuttl tests to work in CI
kevinearls 2f5ade5
Back out addition of AutoScaleSpec to CRD
kevinearls 0bc348b
Fixed api-docs
kevinearls 3ce81aa
Restore accidentally delete test, clean up whitespace
kevinearls aeb4a97
Document that this script is not needed for minikube
kevinearls 96917a2
Fix scaledown
kevinearls 2ef9467
Update webhook to validate minReplicas when needed
kevinearls ba0423b
Fix tests
kevinearls ef318ef
Initial upgrade code for instances with an HPA
kevinearls 27fb26f
Make sure old Deploment based autoscalers get updated
kevinearls c733b6e
Fix lint error
kevinearls 81aa971
Respond to comments
kevinearls f3d190b
Fixed api-docs
kevinearls File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// 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. | ||
|
||
package upgrade | ||
|
||
import ( | ||
"github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1" | ||
) | ||
|
||
func upgrade0_56_0(u VersionUpgrade, otelcol *v1alpha1.OpenTelemetryCollector) (*v1alpha1.OpenTelemetryCollector, error) { | ||
// return if this does not use an autoscaler | ||
if otelcol.Spec.MaxReplicas == nil { | ||
return otelcol, nil | ||
} | ||
|
||
u.Log.Info("in upgrade0_56_0", "Otel Instance", otelcol.Name, "Upgrade version", u.Version.String()) | ||
one := int32(1) | ||
otelcol.Spec.MinReplicas = &one | ||
|
||
return otelcol, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// | ||
// 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. | ||
|
||
package upgrade_test | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
func Test0_56_0Upgrade(t *testing.T) { | ||
fmt.Println("NYI") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apiVersion: opentelemetry.io/v1alpha1 | ||
kind: OpenTelemetryCollector | ||
metadata: | ||
name: simplest | ||
spec: | ||
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.