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

Enhance PVC for filesystem storage #240

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ nb-configuration.xml
!application/src/main/distribution/*

application/workspace/*
jreleaser/templates/article/openapi.*
src/jreleaser/templates/article/openapi.*
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ public class Constants {
public static final String CERTIFICATES_FOLDER = "/mnt/certificates";
public static final String STORAGE_FOLDER = "/mnt/ublhub-storage";

public static final String STORAGE_MIN_SIZE = "100Mi";

public static final UblhubSpec.XBuilderSpec defaultXBuilderConfig = UblhubSpec.XBuilderSpec.builder()
.moneda("PEN")
.igvTasa("0.18")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,15 @@ private PersistentVolumeClaim newPersistentVolumeClaim(Ublhub cr, Context contex
}

private PersistentVolumeClaimSpec getPersistentVolumeClaimSpec(Ublhub cr) {
boolean isFileSystemStorage = cr.getSpec().getStorageSpec() != null && cr.getSpec().getStorageSpec().getType().equals(UblhubSpec.StorageSpec.Type.filesystem);
Quantity storageSize = isFileSystemStorage ?
new Quantity(cr.getSpec().getStorageSpec().getFilesystemSpec().getSize()) :
new Quantity(Constants.STORAGE_MIN_SIZE);

return new PersistentVolumeClaimSpecBuilder()
.withAccessModes("ReadWriteOnce")
.withResources(new ResourceRequirementsBuilder()
.addToRequests("storage", new Quantity(cr.getSpec().getStorageSpec().getFilesystemSpec().getSize()))
.addToRequests("storage", storageSize)
.build()
)
.build();
Expand Down