Skip to content

Commit

Permalink
Adds support for building and testing mysql helm charts in Shared Clu…
Browse files Browse the repository at this point in the history
…ster

This can be merged as soon as
sclorg/container-ci-suite#86
is merged.

Signed-off-by: Petr "Stone" Hracek <phracek@redhat.com>
  • Loading branch information
phracek committed Oct 18, 2024
1 parent cccfea6 commit 2e31034
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
{{ if .Values.pvc.netapp_nfs }}
annotations:
trident.netapp.io/reclaimPolicy: Delete
{{ end }}
labels:
template: mysql-persistent-template
{{ if .Values.pvc.netapp_nfs }}
paas.redhat.com/appcode: {{ .Values.pvc.app_code }}
{{ end }}
name: {{ .Values.database_service_name }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.volume_capacity }}
storage: {{ .Values.pvc.volume_capacity }}
{{ if .Values.pvc.netapp_nfs }}
storageClassName: netapp-nfs
volumeMode: Filesystem
{{ end }}
20 changes: 20 additions & 0 deletions charts/redhat/mysql-persistent/src/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,26 @@
"type": "string",
"description": "Specify mysql imagestream tag",
"enum": [ "latest", "8.0-el9", "8.0-el8" ]
},
"pvc": {
"type": "object",
"properties": {
"volume_capacity": {
"type": "string",
"title": "Persistent Volume Size",
"form": true,
"render": "slider",
"sliderMin": 1,
"sliderMax": 100,
"sliderUnit": "Gi"
},
"netapp_nfs": {
"type": "boolean"
},
"app_code": {
"type": "string"
}
}
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion charts/redhat/mysql-persistent/src/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ mysql_root_password: testur # TODO: must define a default value for .mysql_root_
mysql_user: testu # TODO: must define a default value for .mysql_user'
mysql_version: 8.0-el8
namespace: openshift
volume_capacity: 1Gi
pvc:
volume_capacity: 1Gi
app_code: "something"
netapp_nfs: false
11 changes: 9 additions & 2 deletions tests/test_mysql_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@ def setup_method(self):
def teardown_method(self):
self.hc_api.delete_project()

def test_package_persistent(self):
@pytest.mark.parametrize(
"version",
[
"8.0-el9",
"8.0-el8",
],
)
def test_package_persistent(self, version):
self.hc_api.package_name = "mysql-imagestreams"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation()
self.hc_api.package_name = "mysql-persistent"
assert self.hc_api.helm_package()
assert self.hc_api.helm_installation(values={".mysql_version": "8.0-el8", ".namespace": self.hc_api.namespace})
assert self.hc_api.helm_installation(values={".mysql_version": version, ".namespace": self.hc_api.namespace})
assert self.hc_api.is_pod_running(pod_name_prefix="mysql")
assert self.hc_api.test_helm_chart(expected_str=["42", "testval"])

0 comments on commit 2e31034

Please sign in to comment.