Skip to content

Commit

Permalink
Add RBAC and e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
Kidswiss committed Oct 17, 2024
1 parent 89f3f92 commit fccec27
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 11 deletions.
5 changes: 5 additions & 0 deletions component/provider.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ local providerRBAC = {
resources: [ 'providerconfigs' ],
verbs: [ 'get', 'list', 'watch', 'update', 'patch', 'create', 'delete' ],
},
{
apiGroups: [ 'mysql.sql.crossplane.io' ],
resources: [ 'providerconfigs' ],
verbs: [ 'get', 'list', 'watch', 'update', 'patch', 'create', 'delete' ],
},
{
apiGroups: [ 'apiextensions.crossplane.io' ],
resources: [ 'usages' ],
Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/mariadb/00-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ kind: VSHNMariaDB
metadata:
finalizers:
- finalizer.apiextensions.crossplane.io
name: mariadb
name: mariadb-e2e
spec:
compositeDeletePolicy: Background
compositionRef:
Expand All @@ -18,6 +18,8 @@ spec:
security:
deletionProtection: true
service:
access:
- user: e2e-test
serviceLevel: besteffort
version: "11.2"
size:
Expand All @@ -43,4 +45,4 @@ metadata:
ownerReferences:
- apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNMariaDB
name: mariadb
name: mariadb-e2e
5 changes: 4 additions & 1 deletion tests/e2e/mariadb/00-install.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNMariaDB
metadata:
name: mariadb
name: mariadb-e2e
spec:
parameters:
service:
access:
- user: e2e-test
size:
plan: standard-2
writeConnectionSecretToRef:
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/mariadb/02-check-protection.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: scripts/check-protection.sh vshnmariadb mariadb
- script: scripts/check-protection.sh vshnmariadb mariadb-e2e
4 changes: 2 additions & 2 deletions tests/e2e/mariadb/03-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ kind: VSHNMariaDB
metadata:
finalizers:
- finalizer.apiextensions.crossplane.io
name: mariadb
name: mariadb-e2e
spec:
compositeDeletePolicy: Background
compositionRef:
Expand Down Expand Up @@ -43,4 +43,4 @@ metadata:
ownerReferences:
- apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNMariaDB
name: mariadb
name: mariadb-e2e
2 changes: 1 addition & 1 deletion tests/e2e/mariadb/03-install.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNMariaDB
metadata:
name: mariadb
name: mariadb-e2e
spec:
parameters:
security:
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/mariadb/99-delete.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ delete:
e2e-test: mariadb
- apiVersion: vshn.appcat.vshn.io/v1
kind: VSHNMariaDB
name: mariadb-e2e-test
name: mariadb-e2e
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
# Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+"
kube_namespace_labels{label_appuio_io_organization=~".+", label_appuio_io_billing_name=~"appcat-.+"} *
on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla, label_appuio_io_billing_name)
(kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"})),
(kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}),
"tenant_id",
"$1",
"label_appuio_io_organization",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
# Fetch all namespaces with label label_appuio_io_billing_name=~"appcat-.+"
(kube_namespace_labels{label_appuio_io_billing_name=~"appcat-.+"} *
on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,label_appcat_vshn_io_claim_name,label_appuio_io_billing_name,label_appuio_io_organization)
(kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"}))
(kube_pod_info{created_by_kind!="Job"} * on(namespace, pod) kube_pod_labels{label_appcat_io_billing="true"})
# We join it with appuio_control_organization_info to map the organization to a sales_order
# This metric is not available on the cluster's prometheus, only on mimir, this is just included for completenes sake.
#* on(label_appuio_io_organization) group_left(sales_order) label_replace(appuio_control_organization_info, "label_appuio_io_organization", "$1", "name", "(.*)")
Expand Down
12 changes: 12 additions & 0 deletions tests/golden/vshn/appcat/appcat/10_provider_kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,18 @@ rules:
- patch
- create
- delete
- apiGroups:
- mysql.sql.crossplane.io
resources:
- providerconfigs
verbs:
- get
- list
- watch
- update
- patch
- create
- delete
- apiGroups:
- apiextensions.crossplane.io
resources:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ spec:
apiVersion: v1
data:
providerConfig: minio
proxyEndpoint: host.docker.internal:9443
serviceName: miniobucket
kind: ConfigMap
metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ spec:
true, "memory": "2Gi"}}, "standard-4": {"size": {"cpu": "1", "disk": "16Gi",
"enabled": true, "memory": "4Gi"}}, "standard-8": {"size": {"cpu": "2",
"disk": "16Gi", "enabled": true, "memory": "8Gi"}}}'
proxyEndpoint: host.docker.internal:9443
quotasEnabled: 'false'
registry_password: ''
registry_username: ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ spec:
{"size": {"cpu": "125m", "disk": "16Gi", "enabled": true, "memory": "512Mi"}},
"standard-8": {"size": {"cpu": "2", "disk": "16Gi", "enabled": true, "memory":
"8Gi"}}}'
proxyEndpoint: host.docker.internal:9443
quotasEnabled: 'false'
restoreSA: mariadbrestoreserviceaccount
serviceName: mariadb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ spec:
true, "memory": "2Gi"}}, "standard-4": {"size": {"cpu": "1", "disk": "16Gi",
"enabled": true, "memory": "4Gi"}}, "standard-8": {"size": {"cpu": "2",
"disk": "16Gi", "enabled": true, "memory": "8Gi"}}}'
proxyEndpoint: host.docker.internal:9443
quotasEnabled: 'false'
restoreSA: nextcloudserviceaccount
serviceName: nextcloud
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ spec:
{"cpu": "400m", "disk": "20Gi", "enabled": true, "memory": "1936Mi"}},
"standard-4": {"size": {"cpu": "900m", "disk": "40Gi", "enabled": true,
"memory": "3984Mi"}}}'
proxyEndpoint: host.docker.internal:9443
quotasEnabled: 'false'
serviceName: postgresql
sgNamespace: stackgres
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ spec:
ownerGroup: vshn.appcat.vshn.io
ownerKind: XVSHNRedis
ownerVersion: v1
proxyEndpoint: host.docker.internal:9443
quotasEnabled: 'false'
restoreSA: redisrestoreserviceaccount
serviceName: redis
Expand Down
2 changes: 1 addition & 1 deletion tests/vshn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ parameters:
appcat:

grpcEndpoint: host.docker.internal:9443
proxyFunction: false
proxyFunction: true

quotasEnabled: false
appuioManaged: false
Expand Down

0 comments on commit fccec27

Please sign in to comment.