Skip to content

Commit 0eb73cc

Browse files
test(backup-restore): Add the option to disable TLS in S3
1 parent 35c99c5 commit 0eb73cc

6 files changed

Lines changed: 79 additions & 14 deletions

tests/templates/kuttl/backup-restore/11_minio-values.yaml renamed to tests/templates/kuttl/backup-restore/11_minio-values.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ console:
1616
repository: bitnamilegacy/minio-object-browser
1717

1818
tls:
19-
enabled: true
19+
enabled: {{ test_scenario['values']['s3-use-tls'] }}
2020

2121
persistence:
2222
enabled: false # "false" means, that an emptyDir is used instead of a persistentVolumeClaim

tests/templates/kuttl/backup-restore/21-install-opensearch-1.yaml.j2

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,19 @@ spec:
4545
plugins.security.authcz.admin_dn: CN=opensearch-1-admin-certificate
4646
plugins.security.restapi.roles_enabled: all_access
4747
plugins.security.ssl.http.pemtrustedcas_filepath: /stackable/opensearch/config/tls/concatenated/ca.crt
48+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
4849
s3.client.default.endpoint: https://minio:9000/
4950
s3.client.default.protocol: https
51+
{% else %}
52+
s3.client.default.endpoint: http://minio:9000/
53+
s3.client.default.protocol: http
54+
{% endif %}
5055
s3.client.default.region: unused # but required
5156
s3.client.default.path_style_access: "true"
5257
podOverrides:
5358
spec:
5459
initContainers:
60+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
5561
- name: init-system-keystore
5662
{% if test_scenario['values']['opensearch'].find(",") > 0 %}
5763
image: "{{ test_scenario['values']['opensearch'].split(',')[1] }}"
@@ -72,6 +78,7 @@ spec:
7278
mountPath: /etc/pki/ca-trust/source/anchors/s3-ca.crt
7379
subPath: tls.crt
7480
readOnly: true
81+
{% endif %}
7582
- name: init-tls
7683
{% if test_scenario['values']['opensearch'].find(",") > 0 %}
7784
image: "{{ test_scenario['values']['opensearch'].split(',')[1] }}"
@@ -106,18 +113,16 @@ spec:
106113
- name: security-config
107114
mountPath: /stackable/opensearch/config/opensearch-security
108115
readOnly: true
116+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
109117
- name: system-trust-store
110118
mountPath: /etc/pki/java/cacerts
111119
subPath: java/cacerts
112120
readOnly: true
121+
{% endif %}
113122
- name: tls-concatenated
114123
mountPath: /stackable/opensearch/config/tls/concatenated
115124
readOnly: true
116125
volumes:
117-
- name: s3-ca-crt
118-
secret:
119-
secretName: minio-ca-crt
120-
defaultMode: 0o660
121126
- name: admin-certificate
122127
secret:
123128
secretName: opensearch-1-admin-certificate
@@ -126,9 +131,15 @@ spec:
126131
secret:
127132
secretName: opensearch-1-security-config
128133
defaultMode: 0o660
134+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
135+
- name: s3-ca-crt
136+
secret:
137+
secretName: minio-ca-crt
138+
defaultMode: 0o660
129139
- name: system-trust-store
130140
emptyDir:
131141
sizeLimit: 10Mi
142+
{% endif %}
132143
- name: tls-concatenated
133144
emptyDir:
134145
sizeLimit: 1Mi

tests/templates/kuttl/backup-restore/31-backup-security-indices.yaml.j2

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ spec:
88
spec:
99
initContainers:
1010
- name: backup-security-indices
11+
{% if test_scenario['values']['opensearch'].find(",") > 0 %}
12+
image: "{{ test_scenario['values']['opensearch'].split(',')[1] }}"
13+
{% else %}
1114
image: oci.stackable.tech/sdp/opensearch:{{ test_scenario['values']['opensearch'].split(',')[0] }}-stackable{{ test_scenario['values']['release'] }}
15+
{% endif %}
1216
command:
1317
- /stackable/scripts/backup-security-indices.sh
1418
envFrom:
@@ -60,8 +64,13 @@ spec:
6064
volumeMounts:
6165
- name: scripts
6266
mountPath: /root/scripts
67+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
6368
- name: s3-ca-crt
6469
mountPath: /root/.mc/certs/CAs
70+
{% else %}
71+
- name: mc-config
72+
mountPath: /root/.mc
73+
{% endif %}
6574
- name: backup
6675
mountPath: /tmp/backup
6776
securityContext:
@@ -90,10 +99,16 @@ spec:
9099
secret:
91100
secretName: opensearch-1-admin-certificate
92101
defaultMode: 0o660
102+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
93103
- name: s3-ca-crt
94104
secret:
95105
secretName: minio-ca-crt
96106
defaultMode: 0o660
107+
{% else %}
108+
- name: mc-config
109+
emptyDir:
110+
sizeLimit: 1Mi
111+
{% endif %}
97112
- name: backup
98113
emptyDir:
99114
sizeLimit: 1Mi
@@ -110,7 +125,7 @@ data:
110125
backup-security-indices.sh: |
111126
#!/usr/bin/env sh
112127

113-
plugins/opensearch-security/tools/securityadmin.sh \
128+
bash plugins/opensearch-security/tools/securityadmin.sh \
114129
-cacert config/tls/ca.crt \
115130
-cert config/tls-client/tls.crt \
116131
-key config/tls-client/tls.key \
@@ -119,6 +134,11 @@ data:
119134
upload-security-indices-backup.sh: |
120135
#!/usr/bin/env sh
121136

122-
mc alias set minio https://minio:9000/ $S3_ACCESS_KEY $S3_SECRET_KEY
137+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
138+
S3_PROTOCOL=https
139+
{% else %}
140+
S3_PROTOCOL=http
141+
{% endif %}
142+
mc alias set minio $S3_PROTOCOL://minio:9000/ $S3_ACCESS_KEY $S3_SECRET_KEY
123143
mc mb minio/opensearch-security
124144
mc cp /tmp/backup/* minio/opensearch-security/

tests/templates/kuttl/backup-restore/51-install-opensearch-2.yaml.j2

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,19 @@ spec:
4545
plugins.security.authcz.admin_dn: CN=opensearch-2-admin-certificate
4646
plugins.security.restapi.roles_enabled: all_access
4747
plugins.security.ssl.http.pemtrustedcas_filepath: /stackable/opensearch/config/tls/concatenated/ca.crt
48+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
4849
s3.client.default.endpoint: https://minio:9000/
4950
s3.client.default.protocol: https
51+
{% else %}
52+
s3.client.default.endpoint: http://minio:9000/
53+
s3.client.default.protocol: http
54+
{% endif %}
5055
s3.client.default.region: unused # but required
5156
s3.client.default.path_style_access: "true"
5257
podOverrides:
5358
spec:
5459
initContainers:
60+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
5561
- name: init-system-keystore
5662
{% if test_scenario['values']['opensearch'].find(",") > 0 %}
5763
image: "{{ test_scenario['values']['opensearch'].split(',')[1] }}"
@@ -72,6 +78,7 @@ spec:
7278
mountPath: /etc/pki/ca-trust/source/anchors/s3-ca.crt
7379
subPath: tls.crt
7480
readOnly: true
81+
{% endif %}
7582
- name: init-tls
7683
{% if test_scenario['values']['opensearch'].find(",") > 0 %}
7784
image: "{{ test_scenario['values']['opensearch'].split(',')[1] }}"
@@ -106,18 +113,16 @@ spec:
106113
- name: security-config
107114
mountPath: /stackable/opensearch/config/opensearch-security
108115
readOnly: true
116+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
109117
- name: system-trust-store
110118
mountPath: /etc/pki/java/cacerts
111119
subPath: java/cacerts
112120
readOnly: true
121+
{% endif %}
113122
- name: tls-concatenated
114123
mountPath: /stackable/opensearch/config/tls/concatenated
115124
readOnly: true
116125
volumes:
117-
- name: s3-ca-crt
118-
secret:
119-
secretName: minio-ca-crt
120-
defaultMode: 0o660
121126
- name: admin-certificate
122127
secret:
123128
secretName: opensearch-2-admin-certificate
@@ -126,9 +131,15 @@ spec:
126131
secret:
127132
secretName: opensearch-2-security-config
128133
defaultMode: 0o660
134+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
135+
- name: s3-ca-crt
136+
secret:
137+
secretName: minio-ca-crt
138+
defaultMode: 0o660
129139
- name: system-trust-store
130140
emptyDir:
131141
sizeLimit: 10Mi
142+
{% endif %}
132143
- name: tls-concatenated
133144
emptyDir:
134145
sizeLimit: 1Mi

tests/templates/kuttl/backup-restore/60-restore-security-indices.yaml.j2

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,13 @@ spec:
2525
volumeMounts:
2626
- name: scripts
2727
mountPath: /root/scripts
28+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
2829
- name: s3-ca-crt
2930
mountPath: /root/.mc/certs/CAs
31+
{% else %}
32+
- name: mc-config
33+
mountPath: /root/.mc
34+
{% endif %}
3035
- name: backup
3136
mountPath: /tmp/backup
3237
securityContext:
@@ -45,7 +50,11 @@ spec:
4550
cpu: 400m
4651
containers:
4752
- name: restore-security-indices
53+
{% if test_scenario['values']['opensearch'].find(",") > 0 %}
54+
image: "{{ test_scenario['values']['opensearch'].split(',')[1] }}"
55+
{% else %}
4856
image: oci.stackable.tech/sdp/opensearch:{{ test_scenario['values']['opensearch'].split(',')[0] }}-stackable{{ test_scenario['values']['release'] }}
57+
{% endif %}
4958
command:
5059
- /stackable/scripts/restore-security-indices.sh
5160
envFrom:
@@ -90,10 +99,16 @@ spec:
9099
secret:
91100
secretName: opensearch-2-admin-certificate
92101
defaultMode: 0o660
102+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
93103
- name: s3-ca-crt
94104
secret:
95105
secretName: minio-ca-crt
96106
defaultMode: 0o660
107+
{% else %}
108+
- name: mc-config
109+
emptyDir:
110+
sizeLimit: 1Mi
111+
{% endif %}
97112
- name: backup
98113
emptyDir:
99114
sizeLimit: 1Mi
@@ -110,12 +125,17 @@ data:
110125
download-security-indices-backup.sh: |
111126
#!/usr/bin/env sh
112127

113-
mc alias set minio https://minio:9000/ $S3_ACCESS_KEY $S3_SECRET_KEY
128+
{% if test_scenario['values']['s3-use-tls'] == 'true' %}
129+
S3_PROTOCOL=https
130+
{% else %}
131+
S3_PROTOCOL=http
132+
{% endif %}
133+
mc alias set minio $S3_PROTOCOL://minio:9000/ $S3_ACCESS_KEY $S3_SECRET_KEY
114134
mc cp --recursive minio/opensearch-security/ /tmp/backup
115135
restore-security-indices.sh: |
116136
#!/usr/bin/env sh
117137

118-
plugins/opensearch-security/tools/securityadmin.sh \
138+
bash plugins/opensearch-security/tools/securityadmin.sh \
119139
-cacert config/tls/ca.crt \
120140
-cert config/tls-client/tls.crt \
121141
-key config/tls-client/tls.key \

tests/test-definition.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ dimensions:
1212
- name: server-use-tls
1313
values:
1414
- "true"
15-
- "false"
15+
- name: s3-use-tls
16+
values:
17+
- "true"
1618
# The release must sometimes be known in podOverrides or Helm values
1719
- name: release
1820
values:
@@ -50,6 +52,7 @@ tests:
5052
dimensions:
5153
- opensearch
5254
- release
55+
- s3-use-tls
5356
suites:
5457
- name: nightly
5558
patch:

0 commit comments

Comments
 (0)