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 user-specified instrumentation volume #3285

Merged
merged 23 commits into from
Oct 23, 2024

Conversation

jnarezo
Copy link
Contributor

@jnarezo jnarezo commented Sep 12, 2024

Description:

Adds the ability for user to specify a custom volume for instrumentation / auto-injection to Instrumentation.spec.<lang>.volumeSizeLimit.

Adds validation to prevent Volume and VolumeSizeLimit being defined simultaneously to prevent overlapping behavior (ex. Do we use Volume.Size or VolumeSizeLimit?)

Link to tracking Issue(s):

Testing:

Unit tests for validation with different combinations of Volume/VolumeSizeLimit being defined and not defined

Documentation:

Updated API docs with new spec.

@jnarezo jnarezo requested a review from a team September 12, 2024 04:31
Copy link

linux-foundation-easycla bot commented Sep 12, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link
Contributor

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

These changes look good to me overall. Some things missing before we can merge this PR:

  • You need to add a changelog entry. Run make chlog-new and fill in the template.
  • Run make precommit and fix any issues it brings up. Right now, the CI is failing because the bundle needs to be updated after changes to CRDs.
  • We should check this volume mechanism in E2E tests. It's fine to modify an existing test.

pkg/instrumentation/helper.go Outdated Show resolved Hide resolved
pkg/instrumentation/helper.go Outdated Show resolved Hide resolved
@jnarezo
Copy link
Contributor Author

jnarezo commented Sep 13, 2024

These changes look good to me overall. Some things missing before we can merge this PR:

  • You need to add a changelog entry. Run make chlog-new and fill in the template.
  • Run make precommit and fix any issues it brings up. Right now, the CI is failing because the bundle needs to be updated after changes to CRDs.
  • We should check this volume mechanism in E2E tests. It's fine to modify an existing test.

Thanks, got it working locally! Was using golang v1.23.x and pipeline was broken on me, so I downgraded.

@swiatekm
Copy link
Contributor

The PR looks great, thanks for the contribution!

There's one big problem with it, and to be clear, this is really Kubernetes' fault. As it turns out, the OpenAPI spec for corev1.Volume is actually quite large, and we're including a copy of it for each language instrumentation. As a result, we're making the Instrumentation CRD much larger. There are consequences to this - for example, if the CRD is too big to fit in a K8s annotation (the limit is ~256kb), then it can't be applied using kubectl apply anymore. Your change pushes the Instrumentation CRD above that limit.

I'm not sure what we can do to alleviate this. We could make the Volume attribute common to all instrumentations. It would make it less flexible, but maybe that's ok? @jaronoff97 @pavolloffay WDYT?

@jnarezo jnarezo requested a review from a team as a code owner October 8, 2024 05:31
@jnarezo
Copy link
Contributor Author

jnarezo commented Oct 8, 2024

Hey @swiatekm, sorry I dropped this for a bit, but I saw that there was no response on your question.

I redesigned the feature to accept a volumeClaimTemplate which is restricted to a generic ephemeral volume to match the solution proposed in the issue.

Although more restrictive that originally planned, I think this still provides about the functionality as an emptyDir and will still allow users with emptyDir restrictions to use a different type of volume, supported by storage drivers.

I think this should work for now. An alternative could be using an existing PVC, but there may be issues with files already existing from previous autoinstrumentation so I did not pursue it further.

What do you think?

@jnarezo
Copy link
Contributor Author

jnarezo commented Oct 8, 2024

Also, restricting the volume allowed me to get the manifest down to ~80KB.

@swiatekm swiatekm added the discuss-at-sig This issue or PR should be discussed at the next SIG meeting label Oct 10, 2024
@swiatekm
Copy link
Contributor

@jnarezo this looks like a reasonable solution to me. Pending any more fundamental changes to the CRD, where we perhaps move all of these common values to the top level, this looks like a good compromise. WDYT @jaronoff97 @pavolloffay ?

Looks like you have some conflicts and failing e2e tests, could you have a look at that?

@jnarezo
Copy link
Contributor Author

jnarezo commented Oct 15, 2024

@jnarezo this looks like a reasonable solution to me. Pending any more fundamental changes to the CRD, where we perhaps move all of these common values to the top level, this looks like a good compromise. WDYT @jaronoff97 @pavolloffay ?

Looks like you have some conflicts and failing e2e tests, could you have a look at that?

Yeah! Sorry, looks like my e2e differed a bit locally. Thanks for working with me on this.

Copy link
Contributor

@jaronoff97 jaronoff97 left a comment

Choose a reason for hiding this comment

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

just one thought, otherwise this looks good. thank you 🙇

// VolumeClaimTemplate defines a ephemeral volume used for auto-instrumentation.
// If omitted, an emptyDir is used with size limit VolumeSizeLimit
VolumeClaimTemplate corev1.PersistentVolumeClaimTemplate `json:"volumeClaimTemplate,omitempty"`

// VolumeSizeLimit defines size limit for volume used for auto-instrumentation.
// The default size is 200Mi.
VolumeSizeLimit *resource.Quantity `json:"volumeLimitSize,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

should we just deprecate this in favor of the volume claim template?

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's open a separate issue for that, I don't think it should be within the scope of this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

@swiatekm swiatekm merged commit 4da4f66 into open-telemetry:main Oct 23, 2024
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss-at-sig This issue or PR should be discussed at the next SIG meeting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow references to other volumes (eg. PVCs) for instrumention auto-inject
3 participants