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 support for persistentVolumeClaimRetentionPolicy field #3354

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

davidhaja
Copy link
Contributor

Description:
Add support for persistentVolumeClaimRetentionPolicy field in opentelemetrycollector CR.
The persistentVolumeClaimRetentionPolicy works only in statefulset mode.
persistentVolumeClaimRetentionPolicy describes the lifecycle of persistent volume claims created from volumeClaimTemplates.

Link to tracking Issue(s):
3305

Testing:
tests/e2e/statefulset-features e2e test updated with the new field.
Unit tests created for the conversion between api versions, statefulset mode check and for the correct propagation of the persistentVolumeClaimRetentionPolicy field.

Documentation:
docs/api.md updated with the new field.

@davidhaja davidhaja requested a review from a team as a code owner October 14, 2024 07:45
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.

Looks good to me, but I'd get rid of the changes to v1alpha and the PersistentVolumeClaimRetentionPolicy function. Less code is better.

)

// PersistentVolumeClaimRetentionPolicy builds the persistentVolumeClaimRetentionPolicy for the given instance.
func PersistentVolumeClaimRetentionPolicy(otelcol v1beta1.OpenTelemetryCollector) *appsv1.StatefulSetPersistentVolumeClaimRetentionPolicy {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this function necessary? It doesn't hurt, but it looks like it only exists for the sake of the if otelcol.Spec.Mode != "statefulset" check, which seems superfluous given that the output struct can only be put in a StatefulSet to begin with.

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've followed the way how the persistentVolumeClaim field is implemented.
So for this function, like:
https://github.com/open-telemetry/opentelemetry-operator/blob/9623f552a7a6c116e5efb51543496b3bca76d7bf/internal/manifests/collector/volumeclaim.go#L26C1-L33C2

If you want, I can remove/change this.

Copy link
Contributor

Choose a reason for hiding this comment

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

That one is also unnecessary in my opinion. There is no point at which the condition is ever false.

apis/v1alpha1/convert.go Outdated Show resolved Hide resolved
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 support for persistentVolumeClaimRetentionPolicy field in statefulset mode
2 participants