From 35b5e73c848a7f9401e8def28f3f33d4329807e7 Mon Sep 17 00:00:00 2001 From: Nicolas Bigler Date: Wed, 29 Nov 2023 17:12:14 +0100 Subject: [PATCH] Add e2e smoke test for MariaDB Signed-off-by: Nicolas Bigler --- component/class/appcat.yml | 1 + component/class/defaults.yml | 29 +++++++++++++------------- component/component/rbac_e2e.jsonnet | 31 ++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 14 deletions(-) create mode 100644 component/component/rbac_e2e.jsonnet diff --git a/component/class/appcat.yml b/component/class/appcat.yml index acc2da865..8243508b1 100644 --- a/component/class/appcat.yml +++ b/component/class/appcat.yml @@ -66,6 +66,7 @@ parameters: - ${_base_directory}/component/statefuleset-resize-controller.jsonnet - ${_base_directory}/component/functions.jsonnet - ${_base_directory}/component/vshn_appcat_services.jsonnet + - ${_base_directory}/component/rbac_e2e.jsonnet input_type: jsonnet output_path: appcat/ diff --git a/component/class/defaults.yml b/component/class/defaults.yml index baaf8b21e..be02ed792 100644 --- a/component/class/defaults.yml +++ b/component/class/defaults.yml @@ -69,19 +69,19 @@ parameters: grpcEndpoint: host.docker.internal:9443 defaultRestoreRoleRules: - apiGroups: - - vshn.appcat.vshn.io + - vshn.appcat.vshn.io resources: - - vshnredis + - vshnredis verbs: - - get + - get - apiGroups: - - 'k8up.io' + - "k8up.io" resources: - snapshots verbs: - get - apiGroups: - - '' + - "" resources: - secrets verbs: @@ -89,26 +89,26 @@ parameters: - create - delete - apiGroups: - - apps + - apps resources: - - statefulsets/scale + - statefulsets/scale verbs: - update - patch - apiGroups: - - apps + - apps resources: - statefulsets verbs: - get - apiGroups: - - batch + - batch resources: - jobs verbs: - get - apiGroups: - - '' + - "" resources: - events verbs: @@ -292,6 +292,7 @@ parameters: vshn: enabled: false externalDatabaseConnectionsEnabled: "false" + e2eTests: false quotasEnabled: ${appcat:quotasEnabled} secretNamespace: ${crossplane:namespace} emailAlerting: @@ -511,12 +512,12 @@ parameters: hasSts: true openshiftTemplate: serviceName: mariadbbyvshn - description: 'The open source relational database management system (DBMS) that is a compatible drop-in replacement for the widely used MySQL database technology' + description: "The open source relational database management system (DBMS) that is a compatible drop-in replacement for the widely used MySQL database technology" message: 'Your MariaDB by VSHN instance is being provisioned, please see \${SECRET_NAME} for access.' url: https://vs.hn/vshn-mariadb - tags: 'database,sql,mariadb' - icon: 'icon-mariadb' - defaultVersion: '11.2' + tags: "database,sql,mariadb" + icon: "icon-mariadb" + defaultVersion: "11.2" enableNetworkPolicy: false secretNamespace: ${appcat:services:vshn:secretNamespace} helmChartVersion: ${appcat:charts:mariadb:version} diff --git a/component/component/rbac_e2e.jsonnet b/component/component/rbac_e2e.jsonnet new file mode 100644 index 000000000..c9288a2c7 --- /dev/null +++ b/component/component/rbac_e2e.jsonnet @@ -0,0 +1,31 @@ +local kap = import 'lib/kapitan.libjsonnet'; +local kube = import 'lib/kube.libjsonnet'; + +local inv = kap.inventory(); +local params = inv.parameters.appcat; + +local e2eNs = kube.Namespace('appcat-e2e') + { + metadata+: { + labels+: { + 'appuio.io/organization': 'vshn', + }, + }, +}; + +local e2eSA = kube.ServiceAccount('appcat-e2e') + { + metadata+: { + namespace: 'appcat-e2e', + }, +}; + +local e2eRoleBinding = kube.RoleBinding('appcat-e2e') + { + metadata+: { + namespace: 'appcat-e2e', + }, + roleRef_: kube.ClusterRole('admin'), + subjects_: [ e2eSA ], +}; + +if params.services.vshn.e2eTests then { + '20_rbac_vshn_e2e_tests': [ e2eSA, e2eRoleBinding ] +} else {}