-
Notifications
You must be signed in to change notification settings - Fork 428
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
base: main
Are you sure you want to change the base?
Add support for persistentVolumeClaimRetentionPolicy field #3354
Conversation
There was a problem hiding this 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 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…difficulty and low added value
…y-operator into 3305-persistentVolumeClaimRetentionPolicy
Description:
Add support for
persistentVolumeClaimRetentionPolicy
field in opentelemetrycollector CR.The
persistentVolumeClaimRetentionPolicy
works only instatefulset
mode.persistentVolumeClaimRetentionPolicy
describes the lifecycle of persistent volume claims created fromvolumeClaimTemplates
.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.