Skip to content

Commit f86fb92

Browse files
authored
Add s3 backups to Helm values (#907)
* Add s3 backups to Helm values * Add s3 backups to Helm values * Add s3 backups to Helm values --------- Co-authored-by: Yevhen Ivantsov <[email protected]>
1 parent 394e63f commit f86fb92

File tree

4 files changed

+58
-23
lines changed

4 files changed

+58
-23
lines changed

src/main/charts/jira/templates/_helpers.tpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,16 @@ volumeClaimTemplates:
411411
value: {{ .Values.jira.s3Storage.attachments.endpointOverride | quote }}
412412
{{- end }}
413413
{{- end }}
414+
{{- if and .Values.jira.s3Storage.backups.bucketName .Values.jira.s3Storage.backups.bucketRegion }}
415+
- name: ATL_S3BACKUPS_BUCKET_NAME
416+
value: {{ .Values.jira.s3Storage.backups.bucketName | quote }}
417+
- name: ATL_S3BACKUPS_REGION
418+
value: {{ .Values.jira.s3Storage.backups.bucketRegion | quote }}
419+
{{- if .Values.jira.s3Storage.backups.endpointOverride }}
420+
- name: ATL_S3BACKUPS_ENDPOINT_OVERRIDE
421+
value: {{ .Values.jira.s3Storage.backups.endpointOverride | quote }}
422+
{{- end }}
423+
{{- end }}
414424
{{- end }}
415425

416426
{{- define "jira.databaseEnvVars" -}}

src/main/charts/jira/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,21 @@ jira:
682682
#
683683
endpointOverride:
684684

685+
backups:
686+
# -- Bucket name to store backups. If a bucket name and region (see below) are defined, Jira will automatically
687+
# use AWS S3 to store backups. Only bucket name is required, not the full arn.
688+
# If you provide the same bucket name for both avatars and backups, they will be stored in the same bucket
689+
#
690+
bucketName:
691+
692+
# -- AWS region where the S3 bucket is located.
693+
#
694+
bucketRegion:
695+
696+
# -- Override the default AWS API endpoint with a custom one
697+
#
698+
endpointOverride:
699+
685700
# Data Center clustering
686701
#
687702
clustering:

src/test/java/test/JiraS3EnabledTest.java

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import test.helm.Helm;
88
import test.model.Product;
99

10+
import java.util.List;
1011
import java.util.Map;
1112

1213
class JiraS3EnabledTest {
@@ -17,38 +18,43 @@ void initHelm(TestInfo testInfo) {
1718
helm = new Helm(testInfo);
1819
}
1920

21+
private static final List<String> STORAGE_TYPES = List.of("avatars", "attachments", "backups");
2022

2123
@ParameterizedTest
2224
@EnumSource(value = Product.class, names = {"jira"})
23-
void jira_s3_avatars_storage_env_vars(Product product) throws Exception {
24-
final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of(
25-
product + ".s3Storage.avatars.bucketName", "my-bucket",
26-
product + ".s3Storage.avatars.bucketRegion", "my-region"
27-
));
25+
void s3_storage_env_vars(Product product) throws Exception {
26+
for (String storageType : STORAGE_TYPES) {
27+
final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of(
28+
product + ".s3Storage." + storageType + ".bucketName", "my-bucket",
29+
product + ".s3Storage." + storageType + ".bucketRegion", "my-region"
30+
));
2831

29-
resources.getStatefulSet(product.getHelmReleaseName())
30-
.getContainer()
31-
.getEnv()
32-
.assertHasValue("ATL_S3AVATARS_BUCKET_NAME", "my-bucket")
33-
.assertHasValue("ATL_S3AVATARS_REGION", "my-region")
34-
.assertDoesNotHaveAnyOf("ATL_S3AVATARS_ENDPOINT_OVERRIDE");
32+
resources.getStatefulSet(product.getHelmReleaseName())
33+
.getContainer()
34+
.getEnv()
35+
.assertHasValue("ATL_S3" + storageType.toUpperCase() + "_BUCKET_NAME", "my-bucket")
36+
.assertHasValue("ATL_S3" + storageType.toUpperCase() + "_REGION", "my-region")
37+
.assertDoesNotHaveAnyOf("ATL_S3" + storageType.toUpperCase() + "_ENDPOINT_OVERRIDE");
38+
}
3539
}
3640

3741
@ParameterizedTest
3842
@EnumSource(value = Product.class, names = {"jira"})
39-
void jira_s3_avatars_storage_endpoint_override(Product product) throws Exception {
40-
final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of(
41-
product + ".s3Storage.avatars.bucketName", "my-bucket",
42-
product + ".s3Storage.avatars.bucketRegion", "my-region",
43-
product + ".s3Storage.avatars.endpointOverride", "http://minio.svc.cluster.local"
44-
));
43+
void s3_storage_endpoint_override(Product product) throws Exception {
44+
for (String storageType : STORAGE_TYPES) {
45+
final var resources = helm.captureKubeResourcesFromHelmChart(product, Map.of(
46+
product + ".s3Storage." + storageType + ".bucketName", "my-bucket",
47+
product + ".s3Storage." + storageType + ".bucketRegion", "my-region",
48+
product + ".s3Storage." + storageType + ".endpointOverride", "http://minio.svc.cluster.local"
49+
));
4550

46-
resources.getStatefulSet(product.getHelmReleaseName())
47-
.getContainer()
48-
.getEnv()
49-
.assertHasValue("ATL_S3AVATARS_BUCKET_NAME", "my-bucket")
50-
.assertHasValue("ATL_S3AVATARS_REGION", "my-region")
51-
.assertHasValue("ATL_S3AVATARS_ENDPOINT_OVERRIDE", "http://minio.svc.cluster.local");
51+
resources.getStatefulSet(product.getHelmReleaseName())
52+
.getContainer()
53+
.getEnv()
54+
.assertHasValue("ATL_S3" + storageType.toUpperCase() + "_BUCKET_NAME", "my-bucket")
55+
.assertHasValue("ATL_S3" + storageType.toUpperCase() + "_REGION", "my-region")
56+
.assertHasValue("ATL_S3" + storageType.toUpperCase() + "_ENDPOINT_OVERRIDE", "http://minio.svc.cluster.local");
57+
}
5258
}
5359

5460
@ParameterizedTest

src/test/resources/expected_helm_output/jira/output.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ data:
189189
bucketName: null
190190
bucketRegion: null
191191
endpointOverride: null
192+
backups:
193+
bucketName: null
194+
bucketRegion: null
195+
endpointOverride: null
192196
securityContext:
193197
fsGroup: 2001
194198
securityContextEnabled: true

0 commit comments

Comments
 (0)