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

Fix panic when spec.replicas is nil #798

Merged
merged 1 commit into from
Apr 7, 2022
Merged

Fix panic when spec.replicas is nil #798

merged 1 commit into from
Apr 7, 2022

Conversation

wei840222
Copy link
Contributor

@wei840222 wei840222 commented Mar 25, 2022

Resolves #803

Since the spec.replicas in docs is not required, so it may be nil.
Need check whether replicas is nil before get value of it.
image

@wei840222 wei840222 requested a review from a team March 25, 2022 13:11
@jpkrohling
Copy link
Member

Which CR led you to reproduce this?

@wei840222
Copy link
Contributor Author

@jpkrohling
this one

apiVersion: opentelemetry.io/v1alpha1
kind: OpenTelemetryCollector
metadata:
  name: otel
spec:
  mode: deployment
  maxReplicas: 3
  config: |
    receivers:
      otlp:
        protocols:
          grpc:
          http:
    processors:

    exporters:
      logging:

    service:
      pipelines:
        traces:
          receivers: [otlp]
          processors: []
          exporters: [logging]

image

@jpkrohling
Copy link
Member

jpkrohling commented Mar 30, 2022

@VineethReddy02 , would you like to take this one? From taking a look at the PR, this is missing at least a unit test. I would also try to reproduce it manually with the CR above.

@VineethReddy02
Copy link
Contributor

sure @jpkrohling, I will test this out and will share my review on the PR for some tests around this check.

@pavolloffay
Copy link
Member

I was able to reproduce it. I will merge this and work on the test in a separate PR

@pavolloffay pavolloffay merged commit f2073ef into open-telemetry:main Apr 7, 2022
@pavolloffay pavolloffay changed the title fix panic when spec.replicas is nil Fix panic when spec.replicas is nil Apr 7, 2022
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting maxReplicas in OpenTelemetryCollector crashes the Otel Operator
4 participants