Skip to content

Add ability to add environment variables to the collector container. … #4187

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

Merged

Conversation

dsessler7
Copy link
Contributor

…Allows users to authenticate exporters with major cloud providers.

Checklist:

  • Have you added an explanation of what your changes do and why you'd like them to be included?
  • Have you updated or added documentation for the change, as applicable?
  • Have you tested your changes on all related environments with successful results, as applicable?
    • Have you added automated tests?

Type of Changes:

  • New feature
  • Bug fix
  • Documentation
  • Testing enhancement
  • Other

What is the current behavior (link to any open issues here)?

User is unable to add environment variables to collector container.

What is the new behavior (if this is a feature change)?

  • Breaking change (fix or feature that would cause existing functionality to change)

User can now add environment variables to the collector container via the instrumentation spec. This feature was added primarily to allow users to set cloud provider authentication variables, such as GOOGLE_APPLICATION_CREDENTIALS, so that the cloud specific exporters can authenticate.

Other Information:

@dsessler7 dsessler7 requested a review from benjaminjb May 28, 2025 22:38
// EnvironmentVariables allows the user to add environment variables to the
// collector container.
// ---
// +kubebuilder:validation:MinItems=1
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this CEL rule do for an optional field? Is it, like, if you put this field in, it can't be blank? (Have you tested with clusters that have and don't have any custom env vars?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly. If it's optional you can of course omit it, but if you do include it then there must be at least one item in the array.

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 tried to add a UniqueItems validation as well, but it said that it increased the runtime complexity too much:

Error from server (Invalid): CustomResourceDefinition.apiextensions.k8s.io "postgresclusters.postgres-operator.crunchydata.com" is invalid: spec.validation.openAPIV3Schema.properties[spec].properties[instrumentation].properties[config].properties[environmentVariables].uniqueItems: Forbidden: uniqueItems cannot be set to true since the runtime complexity becomes quadratic

…Allows users to authenticate exporters with major cloud providers.
@dsessler7 dsessler7 force-pushed the otel-cloud-provider-authentication branch from f777fa2 to 0128cad Compare May 29, 2025 19:29
@dsessler7 dsessler7 merged commit 8f4e976 into CrunchyData:main May 29, 2025
28 of 29 checks passed
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.

2 participants