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 env support to instrumentation kind #674

Merged

Conversation

Duncan-tree-zhou
Copy link
Contributor

@Duncan-tree-zhou Duncan-tree-zhou commented Jan 20, 2022

Resolves #657

  1. allow config customized envs on common and language specific nodes.
  2. only customzied envs start with "OTEL_" is allowed.
  3. env inject priority is :
    pod env > language spec customzied env > language spec config> common customized env > common config

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jan 20, 2022

CLA Signed

The committers are authorized under a signed CLA.

@Duncan-tree-zhou
Copy link
Contributor Author

#657

@Duncan-tree-zhou Duncan-tree-zhou changed the title Duncan/allow config customized envs on common and language specific nodes. allow config customized envs on common and language specific nodes. Jan 20, 2022
@pavolloffay pavolloffay changed the title allow config customized envs on common and language specific nodes. Add env support to instrumentation kind Jan 24, 2022
Copy link
Member

@pavolloffay pavolloffay left a comment

Choose a reason for hiding this comment

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

Could you please add/modify e2e test that verifies this feature? (It's simple to do :))

apis/v1alpha1/instrumentation_types.go Outdated Show resolved Hide resolved
apis/v1alpha1/instrumentation_webhook.go Outdated Show resolved Hide resolved
bundle/metadata/annotations.yaml Outdated Show resolved Hide resolved
@Duncan-tree-zhou
Copy link
Contributor Author

Could you please add/modify e2e test that verifies this feature? (It's simple to do :))

Hi, Are there any guides to add e2e test? And what is the output of e2e test?

@Duncan-tree-zhou
Copy link
Contributor Author

I thinks i get i. will add e2e testcast later.

@VineethReddy02
Copy link
Contributor

@Duncan-tree-zhou Here are existing e2e tests, you can reference the python instrumentation test here.

In Python inst e2e tests:

  1. The 00-install-collector.yaml is the OpenTelemetry collector CR with the required config to test.
  2. The 00-install-instrumentation.yaml is the OpenTelemetry instrumentation CR with the required config to test.
  3. The 01-install-app.yaml is the example app you want to deploy which gets attached with auto-instrumentation init/sidecar containers.
  4. The 01-assert.yaml is what you expect to validate in tests.

Copy link
Member

@pavolloffay pavolloffay left a comment

Choose a reason for hiding this comment

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

Thanks for the updates. It needs some cleanup, e2e tests and it can go in :)

apis/v1alpha1/instrumentation_webhook.go Outdated Show resolved Hide resolved
config/manager/kustomization.yaml Outdated Show resolved Hide resolved
@pavolloffay
Copy link
Member

For the e2e test just add a new variable to the instrumentation CR, app deployment and then verify the final result in the assert yaml.

@Duncan-tree-zhou Duncan-tree-zhou force-pushed the duncan/add_common_configs branch 3 times, most recently from ba64543 to afcf9e6 Compare January 25, 2022 15:02
@Duncan-tree-zhou
Copy link
Contributor Author

thank you @pavolloffay @VineethReddy02 for helping, the testcases finally passed.

--- PASS: kuttl (50.00s)
    --- PASS: kuttl/harness (0.00s)
        --- PASS: kuttl/harness/daemonset-features (6.40s)
        --- PASS: kuttl/harness/smoke-simplest (9.24s)
        --- PASS: kuttl/harness/smoke-statefulset (24.29s)
        --- PASS: kuttl/harness/smoke-pod-annotations (17.89s)
        --- PASS: kuttl/harness/instrumentation-python (25.81s)
        --- PASS: kuttl/harness/statefulset-features (25.82s)
        --- PASS: kuttl/harness/smoke-sidecar (28.83s)
        --- PASS: kuttl/harness/instrumentation-nodejs (22.63s)
        --- PASS: kuttl/harness/instrumentation-java (12.74s)
        --- PASS: kuttl/harness/targetallocator-features (38.43s)
        --- PASS: kuttl/harness/smoke-targetallocator (39.45s)

Copy link
Member

@pavolloffay pavolloffay left a comment

Choose a reason for hiding this comment

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

Looks good to me, one outstanding item is to clarify precedence order and how the env vars are overridden.

apis/v1alpha1/instrumentation_webhook.go Outdated Show resolved Hide resolved
apis/v1alpha1/instrumentation_webhook.go Outdated Show resolved Hide resolved
apis/v1alpha1/instrumentation_types.go Outdated Show resolved Hide resolved
@Duncan-tree-zhou Duncan-tree-zhou force-pushed the duncan/add_common_configs branch 3 times, most recently from ca581b0 to 4f09121 Compare January 26, 2022 14:39
@Duncan-tree-zhou
Copy link
Contributor Author

Hi @pavolloffay , I thinks all problems had been resolved.

Description in doc for env vars is like the following paragraphs, please have a review.

Env defines common env vars. There are four layers for env vars' definitions and the precedence order is: `original container env vars` > `language specific env vars` > `common env vars` > `instrument spec configs' vars`. If the former var had been defined, then the other vars would be ignored.

Env defines java/python/nodejs specific env vars. There are four layers for env vars' definitions and the precedence order is: `original container env vars` > `language specific env vars` > `common env vars` > `instrument spec configs' vars`. If the former var had been defined, then the other vars would be ignored.

@pavolloffay
Copy link
Member

@Duncan-tree-zhou thanks, the PR looks good.

The CI failed on manifest validation. Please re-generate the bundle.

@Duncan-tree-zhou
Copy link
Contributor Author

@pavolloffay updated

@pavolloffay
Copy link
Member

@Duncan-tree-zhou CI failed

@Duncan-tree-zhou Duncan-tree-zhou force-pushed the duncan/add_common_configs branch 2 times, most recently from bf38693 to 8ef1690 Compare January 28, 2022 05:46
@Duncan-tree-zhou
Copy link
Contributor Author

Hi @pavolloffay, go unit test cannot passed in my laptop too even i modified the testcases. it looks like that some setups are missing in my mac. do you have any ideas?

╰$ go test -race -v ./...          
?       github.com/open-telemetry/opentelemetry-operator        [no test files]
=== RUN   TestInstrumentationDefaultingWebhook
--- PASS: TestInstrumentationDefaultingWebhook (0.00s)
=== RUN   TestInstrumentationValidatingWebhook
=== RUN   TestInstrumentationValidatingWebhook/argument_is_not_a_number
=== RUN   TestInstrumentationValidatingWebhook/argument_is_a_wrong_number
=== RUN   TestInstrumentationValidatingWebhook/argument_is_a_number
=== RUN   TestInstrumentationValidatingWebhook/argument_is_missing
--- PASS: TestInstrumentationValidatingWebhook (0.00s)
    --- PASS: TestInstrumentationValidatingWebhook/argument_is_not_a_number (0.00s)
    --- PASS: TestInstrumentationValidatingWebhook/argument_is_a_wrong_number (0.00s)
    --- PASS: TestInstrumentationValidatingWebhook/argument_is_a_number (0.00s)
    --- PASS: TestInstrumentationValidatingWebhook/argument_is_missing (0.00s)
PASS
ok      github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1  2.033s
failed to start testEnv: unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directoryFAIL      github.com/open-telemetry/opentelemetry-operator/controllers    5.159s
=== RUN   TestNewConfig
--- PASS: TestNewConfig (0.00s)
=== RUN   TestCallbackOnChanges
--- PASS: TestCallbackOnChanges (0.00s)
=== RUN   TestAutoDetectInBackground
--- PASS: TestAutoDetectInBackground (0.10s)
PASS
ok      github.com/open-telemetry/opentelemetry-operator/internal/config        2.277s
=== RUN   TestFallbackVersion
--- PASS: TestFallbackVersion (0.00s)
=== RUN   TestVersionFromBuild
--- PASS: TestVersionFromBuild (0.00s)
=== RUN   TestTargetAllocatorFallbackVersion
--- PASS: TestTargetAllocatorFallbackVersion (0.00s)
=== RUN   TestTargetAllocatorVersionFromBuild
--- PASS: TestTargetAllocatorVersionFromBuild (0.00s)
=== RUN   TestAutoInstrumentationJavaFallbackVersion
--- PASS: TestAutoInstrumentationJavaFallbackVersion (0.00s)
=== RUN   TestAutoInstrumentationNodeJSFallbackVersion
--- PASS: TestAutoInstrumentationNodeJSFallbackVersion (0.00s)
=== RUN   TestAutoInstrumentationPythonFallbackVersion
--- PASS: TestAutoInstrumentationPythonFallbackVersion (0.00s)
PASS
ok      github.com/open-telemetry/opentelemetry-operator/internal/version       0.657s
failed to start testEnv: unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directoryFAIL      github.com/open-telemetry/opentelemetry-operator/internal/webhookhandler        2.839s
=== RUN   TestDetectPlatformBasedOnAvailableAPIGroups
--- PASS: TestDetectPlatformBasedOnAvailableAPIGroups (0.01s)
=== RUN   TestUnknownPlatformOnError
--- PASS: TestUnknownPlatformOnError (0.00s)
PASS
ok      github.com/open-telemetry/opentelemetry-operator/pkg/autodetect 1.590s
=== RUN   TestDefaultAnnotations
--- PASS: TestDefaultAnnotations (0.00s)
=== RUN   TestUserAnnotations
--- PASS: TestUserAnnotations (0.00s)
=== RUN   TestAnnotationsPropagateDown
--- PASS: TestAnnotationsPropagateDown (0.00s)
=== RUN   TestContainerNewDefault
--- PASS: TestContainerNewDefault (0.00s)
=== RUN   TestContainerWithImageOverridden
--- PASS: TestContainerWithImageOverridden (0.00s)
=== RUN   TestContainerConfigFlagIsIgnored
--- PASS: TestContainerConfigFlagIsIgnored (0.00s)
=== RUN   TestContainerCustomVolumes
--- PASS: TestContainerCustomVolumes (0.00s)
=== RUN   TestContainerCustomSecurityContext
--- PASS: TestContainerCustomSecurityContext (0.00s)
=== RUN   TestContainerEnvVarsOverridden
--- PASS: TestContainerEnvVarsOverridden (0.00s)
=== RUN   TestContainerDefaultEnvVars
--- PASS: TestContainerDefaultEnvVars (0.00s)
=== RUN   TestContainerResourceRequirements
--- PASS: TestContainerResourceRequirements (0.00s)
=== RUN   TestContainerDefaultResourceRequirements
--- PASS: TestContainerDefaultResourceRequirements (0.00s)
=== RUN   TestContainerArgs
--- PASS: TestContainerArgs (0.00s)
=== RUN   TestContainerImagePullPolicy
--- PASS: TestContainerImagePullPolicy (0.00s)
=== RUN   TestContainerEnvFrom
--- PASS: TestContainerEnvFrom (0.00s)
=== RUN   TestContainerProbe
--- PASS: TestContainerProbe (0.00s)
=== RUN   TestDaemonSetNewDefault
--- PASS: TestDaemonSetNewDefault (0.00s)
=== RUN   TestDaemonsetHostNetwork
--- PASS: TestDaemonsetHostNetwork (0.00s)
=== RUN   TestDaemonsetPodAnnotations
--- PASS: TestDaemonsetPodAnnotations (0.00s)
=== RUN   TestDaemonstPodSecurityContext
--- PASS: TestDaemonstPodSecurityContext (0.00s)
=== RUN   TestDeploymentNewDefault
--- PASS: TestDeploymentNewDefault (0.00s)
=== RUN   TestDeploymentPodAnnotations
--- PASS: TestDeploymentPodAnnotations (0.00s)
=== RUN   TestDeploymenttPodSecurityContext
--- PASS: TestDeploymenttPodSecurityContext (0.00s)
=== RUN   TestLabelsCommonSet
--- PASS: TestLabelsCommonSet (0.00s)
=== RUN   TestLabelsPropagateDown
--- PASS: TestLabelsPropagateDown (0.00s)
=== RUN   TestServiceAccountNewDefault
--- PASS: TestServiceAccountNewDefault (0.00s)
=== RUN   TestServiceAccountOverride
--- PASS: TestServiceAccountOverride (0.00s)
=== RUN   TestStatefulSetNewDefault
--- PASS: TestStatefulSetNewDefault (0.00s)
=== RUN   TestStatefulSetReplicas
--- PASS: TestStatefulSetReplicas (0.00s)
=== RUN   TestStatefulSetVolumeClaimTemplates
--- PASS: TestStatefulSetVolumeClaimTemplates (0.00s)
=== RUN   TestStatefulSetPodAnnotations
--- PASS: TestStatefulSetPodAnnotations (0.00s)
=== RUN   TestStatefulSetPodSecurityContext
--- PASS: TestStatefulSetPodSecurityContext (0.00s)
=== RUN   TestVolumeNewDefault
--- PASS: TestVolumeNewDefault (0.00s)
=== RUN   TestVolumeAllowsMoreToBeAdded
--- PASS: TestVolumeAllowsMoreToBeAdded (0.00s)
=== RUN   TestVolumeClaimNewDefault
--- PASS: TestVolumeClaimNewDefault (0.00s)
=== RUN   TestVolumeClaimAllowsUserToAdd
--- PASS: TestVolumeClaimAllowsUserToAdd (0.00s)
=== RUN   TestVolumeClaimChecksForStatefulset
--- PASS: TestVolumeClaimChecksForStatefulset (0.00s)
PASS
ok      github.com/open-telemetry/opentelemetry-operator/pkg/collector  1.469s
=== RUN   TestConfigToProbeShouldCreateProbeFor
--- PASS: TestConfigToProbeShouldCreateProbeFor (0.01s)
=== RUN   TestConfigToProbeShouldErrorIf
--- PASS: TestConfigToProbeShouldErrorIf (0.00s)
=== RUN   TestInvalidYAML
--- PASS: TestInvalidYAML (0.00s)
=== RUN   TestEmptyString
--- PASS: TestEmptyString (0.00s)
=== RUN   TestExtractPortsFromConfig
--- PASS: TestExtractPortsFromConfig (0.00s)
=== RUN   TestNoPortsParsed
=== RUN   TestNoPortsParsed/empty
=== RUN   TestNoPortsParsed/not_a_map
--- PASS: TestNoPortsParsed (0.00s)
    --- PASS: TestNoPortsParsed/empty (0.00s)
    --- PASS: TestNoPortsParsed/not_a_map (0.00s)
=== RUN   TestInvalidReceivers
=== RUN   TestInvalidReceivers/receiver_isn't_a_map
=== RUN   TestInvalidReceivers/receiver's_endpoint_isn't_string
--- PASS: TestInvalidReceivers (0.00s)
    --- PASS: TestInvalidReceivers/receiver_isn't_a_map (0.00s)
    --- PASS: TestInvalidReceivers/receiver's_endpoint_isn't_string (0.00s)
=== RUN   TestParserFailed
--- PASS: TestParserFailed (0.00s)
PASS
ok      github.com/open-telemetry/opentelemetry-operator/pkg/collector/adapters 1.592s
=== RUN   TestJaegerSelfRegisters
--- PASS: TestJaegerSelfRegisters (0.00s)
=== RUN   TestJaegerIsFoundByName
--- PASS: TestJaegerIsFoundByName (0.00s)
=== RUN   TestJaegerMinimalConfiguration
--- PASS: TestJaegerMinimalConfiguration (0.00s)
=== RUN   TestJaegerPortsOverridden
--- PASS: TestJaegerPortsOverridden (0.00s)
=== RUN   TestJaegerExposeDefaultPorts
--- PASS: TestJaegerExposeDefaultPorts (0.00s)
=== RUN   TestOTLPSelfRegisters
--- PASS: TestOTLPSelfRegisters (0.00s)
=== RUN   TestOTLPIsFoundByName
--- PASS: TestOTLPIsFoundByName (0.00s)
=== RUN   TestOTLPPortsOverridden
--- PASS: TestOTLPPortsOverridden (0.00s)
=== RUN   TestOTLPExposeDefaultPorts
--- PASS: TestOTLPExposeDefaultPorts (0.00s)
=== RUN   TestReceiverPortNames
=== RUN   TestReceiverPortNames/regular_case
=== RUN   TestReceiverPortNames/name_too_long
=== RUN   TestReceiverPortNames/name_with_invalid_chars
=== RUN   TestReceiverPortNames/name_starting_with_invalid_char
--- PASS: TestReceiverPortNames (0.00s)
    --- PASS: TestReceiverPortNames/regular_case (0.00s)
    --- PASS: TestReceiverPortNames/name_too_long (0.00s)
    --- PASS: TestReceiverPortNames/name_with_invalid_chars (0.00s)
    --- PASS: TestReceiverPortNames/name_starting_with_invalid_char (0.00s)
=== RUN   TestReceiverType
=== RUN   TestReceiverType/regular_case
=== RUN   TestReceiverType/named_instance
--- PASS: TestReceiverType (0.00s)
    --- PASS: TestReceiverType/regular_case (0.00s)
    --- PASS: TestReceiverType/named_instance (0.00s)
=== RUN   TestReceiverParsePortFromEndpoint
=== RUN   TestReceiverParsePortFromEndpoint/regular_case
=== RUN   TestReceiverParsePortFromEndpoint/absolute_with_path
=== RUN   TestReceiverParsePortFromEndpoint/no_protocol
=== RUN   TestReceiverParsePortFromEndpoint/just_port
=== RUN   TestReceiverParsePortFromEndpoint/no_port_at_all
--- PASS: TestReceiverParsePortFromEndpoint (0.00s)
    --- PASS: TestReceiverParsePortFromEndpoint/regular_case (0.00s)
    --- PASS: TestReceiverParsePortFromEndpoint/absolute_with_path (0.00s)
    --- PASS: TestReceiverParsePortFromEndpoint/no_protocol (0.00s)
    --- PASS: TestReceiverParsePortFromEndpoint/just_port (0.00s)
    --- PASS: TestReceiverParsePortFromEndpoint/no_port_at_all (0.00s)
=== RUN   TestReceiverFailsWhenPortIsntString
--- PASS: TestReceiverFailsWhenPortIsntString (0.00s)
=== RUN   TestIgnorekubeletstatsEndpoint
--- PASS: TestIgnorekubeletstatsEndpoint (0.00s)
=== RUN   TestReceiverFallbackWhenNotRegistered
--- PASS: TestReceiverFallbackWhenNotRegistered (0.00s)
=== RUN   TestReceiverShouldFindRegisteredParser
--- PASS: TestReceiverShouldFindRegisteredParser (0.00s)
=== RUN   TestParseEndpoint
--- PASS: TestParseEndpoint (0.00s)
=== RUN   TestFailedToParseEndpoint
--- PASS: TestFailedToParseEndpoint (0.00s)
=== RUN   TestDownstreamParsers
=== RUN   TestDownstreamParsers/zipkin
=== RUN   TestDownstreamParsers/zipkin/builds_successfully
=== RUN   TestDownstreamParsers/zipkin/assigns_the_expected_port
=== RUN   TestDownstreamParsers/zipkin/allows_port_to_be_overridden
=== RUN   TestDownstreamParsers/opencensus
=== RUN   TestDownstreamParsers/opencensus/builds_successfully
=== RUN   TestDownstreamParsers/opencensus/assigns_the_expected_port
=== RUN   TestDownstreamParsers/opencensus/allows_port_to_be_overridden
=== RUN   TestDownstreamParsers/carbon
=== RUN   TestDownstreamParsers/carbon/builds_successfully
=== RUN   TestDownstreamParsers/carbon/assigns_the_expected_port
=== RUN   TestDownstreamParsers/carbon/allows_port_to_be_overridden
=== RUN   TestDownstreamParsers/collectd
=== RUN   TestDownstreamParsers/collectd/builds_successfully
=== RUN   TestDownstreamParsers/collectd/assigns_the_expected_port
=== RUN   TestDownstreamParsers/collectd/allows_port_to_be_overridden
=== RUN   TestDownstreamParsers/sapm
=== RUN   TestDownstreamParsers/sapm/builds_successfully
=== RUN   TestDownstreamParsers/sapm/assigns_the_expected_port
=== RUN   TestDownstreamParsers/sapm/allows_port_to_be_overridden
=== RUN   TestDownstreamParsers/signalfx
=== RUN   TestDownstreamParsers/signalfx/builds_successfully
=== RUN   TestDownstreamParsers/signalfx/assigns_the_expected_port
=== RUN   TestDownstreamParsers/signalfx/allows_port_to_be_overridden
=== RUN   TestDownstreamParsers/wavefront
=== RUN   TestDownstreamParsers/wavefront/builds_successfully
=== RUN   TestDownstreamParsers/wavefront/assigns_the_expected_port
=== RUN   TestDownstreamParsers/wavefront/allows_port_to_be_overridden
=== RUN   TestDownstreamParsers/zipkin-scribe
=== RUN   TestDownstreamParsers/zipkin-scribe/builds_successfully
=== RUN   TestDownstreamParsers/zipkin-scribe/assigns_the_expected_port
=== RUN   TestDownstreamParsers/zipkin-scribe/allows_port_to_be_overridden
=== RUN   TestDownstreamParsers/fluentforward
=== RUN   TestDownstreamParsers/fluentforward/builds_successfully
=== RUN   TestDownstreamParsers/fluentforward/assigns_the_expected_port
=== RUN   TestDownstreamParsers/fluentforward/allows_port_to_be_overridden
=== RUN   TestDownstreamParsers/statsd
=== RUN   TestDownstreamParsers/statsd/builds_successfully
=== RUN   TestDownstreamParsers/statsd/assigns_the_expected_port
=== RUN   TestDownstreamParsers/statsd/allows_port_to_be_overridden
=== RUN   TestDownstreamParsers/influxdb
=== RUN   TestDownstreamParsers/influxdb/builds_successfully
=== RUN   TestDownstreamParsers/influxdb/assigns_the_expected_port
=== RUN   TestDownstreamParsers/influxdb/allows_port_to_be_overridden
=== RUN   TestDownstreamParsers/splunk-hec
=== RUN   TestDownstreamParsers/splunk-hec/builds_successfully
=== RUN   TestDownstreamParsers/splunk-hec/assigns_the_expected_port
=== RUN   TestDownstreamParsers/splunk-hec/allows_port_to_be_overridden
=== RUN   TestDownstreamParsers/awsxray
=== RUN   TestDownstreamParsers/awsxray/builds_successfully
=== RUN   TestDownstreamParsers/awsxray/assigns_the_expected_port
=== RUN   TestDownstreamParsers/awsxray/allows_port_to_be_overridden
--- PASS: TestDownstreamParsers (0.11s)
    --- PASS: TestDownstreamParsers/zipkin (0.00s)
        --- PASS: TestDownstreamParsers/zipkin/builds_successfully (0.00s)
        --- PASS: TestDownstreamParsers/zipkin/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/zipkin/allows_port_to_be_overridden (0.00s)
    --- PASS: TestDownstreamParsers/opencensus (0.00s)
        --- PASS: TestDownstreamParsers/opencensus/builds_successfully (0.00s)
        --- PASS: TestDownstreamParsers/opencensus/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/opencensus/allows_port_to_be_overridden (0.00s)
    --- PASS: TestDownstreamParsers/carbon (0.00s)
        --- PASS: TestDownstreamParsers/carbon/builds_successfully (0.00s)
        --- PASS: TestDownstreamParsers/carbon/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/carbon/allows_port_to_be_overridden (0.00s)
    --- PASS: TestDownstreamParsers/collectd (0.00s)
        --- PASS: TestDownstreamParsers/collectd/builds_successfully (0.00s)
        --- PASS: TestDownstreamParsers/collectd/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/collectd/allows_port_to_be_overridden (0.00s)
    --- PASS: TestDownstreamParsers/sapm (0.00s)
        --- PASS: TestDownstreamParsers/sapm/builds_successfully (0.00s)
        --- PASS: TestDownstreamParsers/sapm/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/sapm/allows_port_to_be_overridden (0.00s)
    --- PASS: TestDownstreamParsers/signalfx (0.00s)
        --- PASS: TestDownstreamParsers/signalfx/builds_successfully (0.00s)
        --- PASS: TestDownstreamParsers/signalfx/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/signalfx/allows_port_to_be_overridden (0.00s)
    --- PASS: TestDownstreamParsers/wavefront (0.00s)
        --- PASS: TestDownstreamParsers/wavefront/builds_successfully (0.00s)
        --- PASS: TestDownstreamParsers/wavefront/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/wavefront/allows_port_to_be_overridden (0.00s)
    --- PASS: TestDownstreamParsers/zipkin-scribe (0.06s)
        --- PASS: TestDownstreamParsers/zipkin-scribe/builds_successfully (0.04s)
        --- PASS: TestDownstreamParsers/zipkin-scribe/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/zipkin-scribe/allows_port_to_be_overridden (0.00s)
    --- PASS: TestDownstreamParsers/fluentforward (0.00s)
        --- PASS: TestDownstreamParsers/fluentforward/builds_successfully (0.00s)
        --- PASS: TestDownstreamParsers/fluentforward/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/fluentforward/allows_port_to_be_overridden (0.00s)
    --- PASS: TestDownstreamParsers/statsd (0.00s)
        --- PASS: TestDownstreamParsers/statsd/builds_successfully (0.00s)
        --- PASS: TestDownstreamParsers/statsd/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/statsd/allows_port_to_be_overridden (0.00s)
    --- PASS: TestDownstreamParsers/influxdb (0.00s)
        --- PASS: TestDownstreamParsers/influxdb/builds_successfully (0.00s)
        --- PASS: TestDownstreamParsers/influxdb/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/influxdb/allows_port_to_be_overridden (0.00s)
    --- PASS: TestDownstreamParsers/splunk-hec (0.00s)
        --- PASS: TestDownstreamParsers/splunk-hec/builds_successfully (0.00s)
        --- PASS: TestDownstreamParsers/splunk-hec/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/splunk-hec/allows_port_to_be_overridden (0.00s)
    --- PASS: TestDownstreamParsers/awsxray (0.00s)
        --- PASS: TestDownstreamParsers/awsxray/builds_successfully (0.00s)
        --- PASS: TestDownstreamParsers/awsxray/assigns_the_expected_port (0.00s)
        --- PASS: TestDownstreamParsers/awsxray/allows_port_to_be_overridden (0.00s)
PASS
ok      github.com/open-telemetry/opentelemetry-operator/pkg/collector/parser   0.938s
failed to start testEnv: unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directoryFAIL      github.com/open-telemetry/opentelemetry-operator/pkg/collector/reconcile        6.185s
failed to start testEnv: unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directoryFAIL      github.com/open-telemetry/opentelemetry-operator/pkg/collector/upgrade  3.328s
failed to start testEnv: unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directoryFAIL      github.com/open-telemetry/opentelemetry-operator/pkg/instrumentation    3.617s
failed to start testEnv: unable to start control plane itself: failed to start the controlplane. retried 5 times: fork/exec /usr/local/kubebuilder/bin/etcd: no such file or directoryFAIL      github.com/open-telemetry/opentelemetry-operator/pkg/instrumentation/upgrade    4.024s
=== RUN   TestDnsName
--- PASS: TestDnsName (0.00s)
=== RUN   TestTruncate
=== RUN   TestTruncate/the_standard_case
=== RUN   TestTruncate/first_N_case
=== RUN   TestTruncate/instance_+_fixed_within_bounds
=== RUN   TestTruncate/first_value_gets_dropped,_second_truncated
=== RUN   TestTruncate/first_value_gets_truncated,_second_added
=== RUN   TestTruncate/first_value_gets_passed,_second_truncated
--- PASS: TestTruncate (0.00s)
    --- PASS: TestTruncate/the_standard_case (0.00s)
    --- PASS: TestTruncate/first_N_case (0.00s)
    --- PASS: TestTruncate/instance_+_fixed_within_bounds (0.00s)
    --- PASS: TestTruncate/first_value_gets_dropped,_second_truncated (0.00s)
    --- PASS: TestTruncate/first_value_gets_truncated,_second_added (0.00s)
    --- PASS: TestTruncate/first_value_gets_passed,_second_truncated (0.00s)
=== RUN   TestTrimNonAlphaNumeric
--- PASS: TestTrimNonAlphaNumeric (0.00s)
PASS
ok      github.com/open-telemetry/opentelemetry-operator/pkg/naming     4.320s
?       github.com/open-telemetry/opentelemetry-operator/pkg/platform   [no test files]
=== RUN   TestEffectiveAnnotationValue
=== RUN   TestEffectiveAnnotationValue/pod-true-overrides-ns
=== RUN   TestEffectiveAnnotationValue/ns-has-concrete-instance
=== RUN   TestEffectiveAnnotationValue/pod-has-concrete-instance
=== RUN   TestEffectiveAnnotationValue/pod-has-explicit-false
=== RUN   TestEffectiveAnnotationValue/pod-has-no-annotations
=== RUN   TestEffectiveAnnotationValue/ns-has-no-annotations
--- PASS: TestEffectiveAnnotationValue (0.00s)
    --- PASS: TestEffectiveAnnotationValue/pod-true-overrides-ns (0.00s)
    --- PASS: TestEffectiveAnnotationValue/ns-has-concrete-instance (0.00s)
    --- PASS: TestEffectiveAnnotationValue/pod-has-concrete-instance (0.00s)
    --- PASS: TestEffectiveAnnotationValue/pod-has-explicit-false (0.00s)
    --- PASS: TestEffectiveAnnotationValue/pod-has-no-annotations (0.00s)
    --- PASS: TestEffectiveAnnotationValue/ns-has-no-annotations (0.00s)
=== RUN   TestAddSidecarWhenNoSidecarExists
--- PASS: TestAddSidecarWhenNoSidecarExists (0.00s)
=== RUN   TestAddSidecarWhenOneExistsAlready
--- PASS: TestAddSidecarWhenOneExistsAlready (0.00s)
=== RUN   TestRemoveSidecar
--- PASS: TestRemoveSidecar (0.00s)
=== RUN   TestRemoveNonExistingSidecar
--- PASS: TestRemoveNonExistingSidecar (0.00s)
=== RUN   TestExistsIn
=== RUN   TestExistsIn/has-sidecar
=== RUN   TestExistsIn/does-not-have-sidecar
--- PASS: TestExistsIn (0.00s)
    --- PASS: TestExistsIn/has-sidecar (0.00s)
    --- PASS: TestExistsIn/does-not-have-sidecar (0.00s)
PASS
ok      github.com/open-telemetry/opentelemetry-operator/pkg/sidecar    5.786s
=== RUN   TestContainerNewDefault
--- PASS: TestContainerNewDefault (0.00s)
=== RUN   TestContainerWithImageOverridden
--- PASS: TestContainerWithImageOverridden (0.00s)
=== RUN   TestContainerVolumes
--- PASS: TestContainerVolumes (0.00s)
=== RUN   TestDeploymentNewDefault
--- PASS: TestDeploymentNewDefault (0.00s)
=== RUN   TestDeploymentPodAnnotations
--- PASS: TestDeploymentPodAnnotations (0.00s)
=== RUN   TestLabelsCommonSet
--- PASS: TestLabelsCommonSet (0.00s)
=== RUN   TestLabelsPropagateDown
--- PASS: TestLabelsPropagateDown (0.00s)
=== RUN   TestVolumeNewDefault
--- PASS: TestVolumeNewDefault (0.00s)
PASS
ok      github.com/open-telemetry/opentelemetry-operator/pkg/targetallocator    5.475s
=== RUN   TestExtractPromConfigFromConfig
--- PASS: TestExtractPromConfigFromConfig (0.00s)
=== RUN   TestExtractPromConfigFromNullConfig
--- PASS: TestExtractPromConfigFromNullConfig (0.00s)
PASS
ok      github.com/open-telemetry/opentelemetry-operator/pkg/targetallocator/adapters   5.309s
FAIL

@pavolloffay
Copy link
Member

Take a look makefile https://github.com/pavolloffay/jaeger-operator/blob/8c81be4b30de53d562074384b482e55c9f10c928/Makefile#L143. the unit test goal uses envtest, probably this is missing in your local setup.

@Duncan-tree-zhou
Copy link
Contributor Author

Exactly, Thank you for your infomation, Now all ci unit tests are passed locally.

go test -race ./...
?       github.com/open-telemetry/opentelemetry-operator        [no test files]
ok      github.com/open-telemetry/opentelemetry-operator/apis/v1alpha1  (cached)
ok      github.com/open-telemetry/opentelemetry-operator/controllers    (cached)
ok      github.com/open-telemetry/opentelemetry-operator/internal/config        (cached)
ok      github.com/open-telemetry/opentelemetry-operator/internal/version       (cached)
ok      github.com/open-telemetry/opentelemetry-operator/internal/webhookhandler        (cached)
ok      github.com/open-telemetry/opentelemetry-operator/pkg/autodetect (cached)
ok      github.com/open-telemetry/opentelemetry-operator/pkg/collector  (cached)
ok      github.com/open-telemetry/opentelemetry-operator/pkg/collector/adapters (cached)
ok      github.com/open-telemetry/opentelemetry-operator/pkg/collector/parser   (cached)
ok      github.com/open-telemetry/opentelemetry-operator/pkg/collector/reconcile        (cached)
ok      github.com/open-telemetry/opentelemetry-operator/pkg/collector/upgrade  (cached)
ok      github.com/open-telemetry/opentelemetry-operator/pkg/instrumentation    18.866s
ok      github.com/open-telemetry/opentelemetry-operator/pkg/instrumentation/upgrade    (cached)
ok      github.com/open-telemetry/opentelemetry-operator/pkg/naming     (cached)
?       github.com/open-telemetry/opentelemetry-operator/pkg/platform   [no test files]
ok      github.com/open-telemetry/opentelemetry-operator/pkg/sidecar    (cached)
ok      github.com/open-telemetry/opentelemetry-operator/pkg/targetallocator    (cached)
ok      github.com/open-telemetry/opentelemetry-operator/pkg/targetallocator/adapters   (cached)

@jpkrohling jpkrohling merged commit 2105dad into open-telemetry:main Jan 28, 2022
ItielOlenick pushed a commit to ItielOlenick/opentelemetry-operator that referenced this pull request May 1, 2024
* allow config customized envs on common and language specific node.

* only env name start with "OTEL_" is allowed.

* deployment env > language spec customzied env > language spec config type> common customized env > common config type

* api docs gen and code fmt

* use corev1.EnvVar instead of Env

* fixing wrong change.

* update e2e testcases

* fix unit tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more configuration for auto-instrumentations
4 participants