diff --git a/src/main/charts/jira/templates/_helpers.tpl b/src/main/charts/jira/templates/_helpers.tpl index 732ff1f19..5da963072 100644 --- a/src/main/charts/jira/templates/_helpers.tpl +++ b/src/main/charts/jira/templates/_helpers.tpl @@ -411,6 +411,16 @@ volumeClaimTemplates: value: {{ .Values.jira.s3Storage.attachments.endpointOverride | quote }} {{- end }} {{- end }} +{{- if and .Values.jira.s3Storage.backups.bucketName .Values.jira.s3Storage.backups.bucketRegion }} +- name: ATL_S3BACKUPS_BUCKET_NAME + value: {{ .Values.jira.s3Storage.backups.bucketName | quote }} +- name: ATL_S3BACKUPS_REGION + value: {{ .Values.jira.s3Storage.backups.bucketRegion | quote }} +{{- if .Values.jira.s3Storage.backups.endpointOverride }} +- name: ATL_S3BACKUPS_ENDPOINT_OVERRIDE + value: {{ .Values.jira.s3Storage.backups.endpointOverride | quote }} +{{- end }} +{{- end }} {{- end }} {{- define "jira.databaseEnvVars" -}} diff --git a/src/main/charts/jira/values.yaml b/src/main/charts/jira/values.yaml index ed6798e2e..cf15d7077 100644 --- a/src/main/charts/jira/values.yaml +++ b/src/main/charts/jira/values.yaml @@ -682,6 +682,21 @@ jira: # endpointOverride: + backups: + # -- Bucket name to store backups. If a bucket name and region (see below) are defined, Jira will automatically + # use AWS S3 to store backups. Only bucket name is required, not the full arn. + # If you provide the same bucket name for both avatars and backups, they will be stored in the same bucket + # + bucketName: + + # -- AWS region where the S3 bucket is located. + # + bucketRegion: + + # -- Override the default AWS API endpoint with a custom one + # + endpointOverride: + # Data Center clustering # clustering: diff --git a/src/test/java/test/JiraS3EnabledTest.java b/src/test/java/test/JiraS3EnabledTest.java index 6acac8e41..1d65dff3b 100644 --- a/src/test/java/test/JiraS3EnabledTest.java +++ b/src/test/java/test/JiraS3EnabledTest.java @@ -7,6 +7,7 @@ import test.helm.Helm; import test.model.Product; +import java.util.List; import java.util.Map; class JiraS3EnabledTest { @@ -17,38 +18,43 @@ void initHelm(TestInfo testInfo) { helm = new Helm(testInfo); } + private static final List STORAGE_TYPES = List.of("avatars", "attachments", "backups"); @ParameterizedTest @EnumSource(value = Product.class, names = {"jira"}) - void jira_s3_avatars_storage_env_vars(Product product) throws Exception { - final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of( - product + ".s3Storage.avatars.bucketName", "my-bucket", - product + ".s3Storage.avatars.bucketRegion", "my-region" - )); + void s3_storage_env_vars(Product product) throws Exception { + for (String storageType : STORAGE_TYPES) { + final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of( + product + ".s3Storage." + storageType + ".bucketName", "my-bucket", + product + ".s3Storage." + storageType + ".bucketRegion", "my-region" + )); - resources.getStatefulSet(product.getHelmReleaseName()) - .getContainer() - .getEnv() - .assertHasValue("ATL_S3AVATARS_BUCKET_NAME", "my-bucket") - .assertHasValue("ATL_S3AVATARS_REGION", "my-region") - .assertDoesNotHaveAnyOf("ATL_S3AVATARS_ENDPOINT_OVERRIDE"); + resources.getStatefulSet(product.getHelmReleaseName()) + .getContainer() + .getEnv() + .assertHasValue("ATL_S3" + storageType.toUpperCase() + "_BUCKET_NAME", "my-bucket") + .assertHasValue("ATL_S3" + storageType.toUpperCase() + "_REGION", "my-region") + .assertDoesNotHaveAnyOf("ATL_S3" + storageType.toUpperCase() + "_ENDPOINT_OVERRIDE"); + } } @ParameterizedTest @EnumSource(value = Product.class, names = {"jira"}) - void jira_s3_avatars_storage_endpoint_override(Product product) throws Exception { - final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of( - product + ".s3Storage.avatars.bucketName", "my-bucket", - product + ".s3Storage.avatars.bucketRegion", "my-region", - product + ".s3Storage.avatars.endpointOverride", "http://minio.svc.cluster.local" - )); + void s3_storage_endpoint_override(Product product) throws Exception { + for (String storageType : STORAGE_TYPES) { + final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of( + product + ".s3Storage." + storageType + ".bucketName", "my-bucket", + product + ".s3Storage." + storageType + ".bucketRegion", "my-region", + product + ".s3Storage." + storageType + ".endpointOverride", "http://minio.svc.cluster.local" + )); - resources.getStatefulSet(product.getHelmReleaseName()) - .getContainer() - .getEnv() - .assertHasValue("ATL_S3AVATARS_BUCKET_NAME", "my-bucket") - .assertHasValue("ATL_S3AVATARS_REGION", "my-region") - .assertHasValue("ATL_S3AVATARS_ENDPOINT_OVERRIDE", "http://minio.svc.cluster.local"); + resources.getStatefulSet(product.getHelmReleaseName()) + .getContainer() + .getEnv() + .assertHasValue("ATL_S3" + storageType.toUpperCase() + "_BUCKET_NAME", "my-bucket") + .assertHasValue("ATL_S3" + storageType.toUpperCase() + "_REGION", "my-region") + .assertHasValue("ATL_S3" + storageType.toUpperCase() + "_ENDPOINT_OVERRIDE", "http://minio.svc.cluster.local"); + } } @ParameterizedTest diff --git a/src/test/resources/expected_helm_output/jira/output.yaml b/src/test/resources/expected_helm_output/jira/output.yaml index 18bdc8ffb..739e06570 100644 --- a/src/test/resources/expected_helm_output/jira/output.yaml +++ b/src/test/resources/expected_helm_output/jira/output.yaml @@ -189,6 +189,10 @@ data: bucketName: null bucketRegion: null endpointOverride: null + backups: + bucketName: null + bucketRegion: null + endpointOverride: null securityContext: fsGroup: 2001 securityContextEnabled: true