Skip to content

Commit 1c3b908

Browse files
test: Grant the privileged SCC in the data-hub-resource-info test (#916)
* test: Grant the privileged SCC in the data-hub-resource-info test * test: Move the SCC grant into its own data-hub-resource-info step
1 parent 79837cf commit 1c3b908

16 files changed

Lines changed: 78 additions & 31 deletions
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{% if test_scenario['values']['openshift'] == 'true' %}
2+
# This test's Pods hardcode runAsUser/fsGroup 1000 (OpenSearch, DataHub) and
3+
# 1001 (Bitnami MySQL/Kafka), and three init containers run as root -- all
4+
# outside the UID range OpenShift assigns to the namespace, so `restricted-v2`
5+
# rejects every Pod.
6+
---
7+
kind: Role
8+
apiVersion: rbac.authorization.k8s.io/v1
9+
metadata:
10+
name: use-integration-tests-scc
11+
rules:
12+
- apiGroups:
13+
- security.openshift.io
14+
resources:
15+
- securitycontextconstraints
16+
resourceNames:
17+
- privileged
18+
verbs:
19+
- use
20+
---
21+
# The charts create their own ServiceAccounts, so most subjects below name
22+
# accounts that do not exist yet: the grant must precede `helm install`, which
23+
# starts workloads right away (`datahub-system-update` runs as a pre-install
24+
# hook).
25+
kind: RoleBinding
26+
apiVersion: rbac.authorization.k8s.io/v1
27+
metadata:
28+
name: use-integration-tests-scc
29+
subjects:
30+
# OpenSearch and the test's own Jobs run as `default`.
31+
- kind: ServiceAccount
32+
name: default
33+
- kind: ServiceAccount
34+
name: prerequisites-kafka
35+
- kind: ServiceAccount
36+
name: prerequisites-mysql
37+
# datahub-frontend and datahub-gms.
38+
- kind: ServiceAccount
39+
name: datahub-app-sa
40+
# datahub-system-update and datahub-system-update-nonblk.
41+
- kind: ServiceAccount
42+
name: datahub-operator-sa
43+
roleRef:
44+
kind: Role
45+
name: use-integration-tests-scc
46+
apiGroup: rbac.authorization.k8s.io
47+
{% endif %}

‎tests/templates/kuttl/data-hub-resource-info/02-assert.yaml‎

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/templates/kuttl/data-hub-resource-info/01-assert.yaml.j2 renamed to tests/templates/kuttl/data-hub-resource-info/02-assert.yaml.j2

File renamed without changes.

tests/templates/kuttl/data-hub-resource-info/01-install-vector-aggregator-discovery-configmap.yaml.j2 renamed to tests/templates/kuttl/data-hub-resource-info/02-install-vector-aggregator-discovery-configmap.yaml.j2

File renamed without changes.
Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
22
apiVersion: kuttl.dev/v1beta1
33
kind: TestAssert
4-
# GMS waits for the system-update bootstrap job (schema + indices) before it goes ready,
5-
# so give this plenty of headroom.
4+
# OpenSearch + Kafka can be slow to become ready on a cold cluster (image pulls, JVM start).
65
timeout: 900
76
commands:
8-
- script: kubectl -n $NAMESPACE rollout status --timeout=890s deployment/datahub-datahub-gms
9-
- script: kubectl -n $NAMESPACE rollout status --timeout=890s deployment/datahub-datahub-frontend
7+
# Wait for the stateful prerequisites to be ready before installing DataHub itself.
8+
# (Pod/StatefulSet names come from the `prerequisites` release; adjust if a chart bump
9+
# renames them.)
10+
- script: kubectl -n $NAMESPACE rollout status --timeout=590s statefulset/opensearch-cluster-master
11+
- script: kubectl -n $NAMESPACE rollout status --timeout=590s statefulset/prerequisites-mysql
12+
- script: kubectl -n $NAMESPACE rollout status --timeout=590s statefulset/prerequisites-kafka-controller

tests/templates/kuttl/data-hub-resource-info/02-install-datahub-prerequisites.yaml.j2 renamed to tests/templates/kuttl/data-hub-resource-info/03-install-datahub-prerequisites.yaml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ commands:
2828
--namespace $NAMESPACE
2929
--version {{ test_scenario['values']['data-hub-prerequisites'] }}
3030
--repo https://helm.datahubproject.io
31-
--values 02_datahub-prerequisites-values.yaml
31+
--values 03_datahub-prerequisites-values.yaml

tests/templates/kuttl/data-hub-resource-info/02_datahub-prerequisites-values.yaml renamed to tests/templates/kuttl/data-hub-resource-info/03_datahub-prerequisites-values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ opensearch:
5353

5454
mysql:
5555
auth:
56-
# Root password is read from the `mysql-secrets` Secret created in 02-install-datahub-prerequisites.
56+
# Root password is read from the `mysql-secrets` Secret created in 03-install-datahub-prerequisites.
5757
# This is the same Secret the datahub chart reads (its default global.sql.datasource.password).
5858
existingSecret: mysql-secrets
5959
database: datahub
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
2-
# The credentials Secret for the resource-info-fetcher exists.
3-
apiVersion: v1
4-
kind: Secret
5-
metadata:
6-
name: datahub-rif-credentials
2+
apiVersion: kuttl.dev/v1beta1
3+
kind: TestAssert
4+
# GMS waits for the system-update bootstrap job (schema + indices) before it goes ready,
5+
# so give this plenty of headroom.
6+
timeout: 900
7+
commands:
8+
- script: kubectl -n $NAMESPACE rollout status --timeout=890s deployment/datahub-datahub-gms
9+
- script: kubectl -n $NAMESPACE rollout status --timeout=890s deployment/datahub-datahub-frontend

tests/templates/kuttl/data-hub-resource-info/03-install-datahub.yaml.j2 renamed to tests/templates/kuttl/data-hub-resource-info/04-install-datahub.yaml.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ kind: TestStep
44
commands:
55
# The chart installs its bootstrap jobs (MySQL schema, Kafka topics, OpenSearch indices,
66
# `datahub-system-update`) as Helm hooks, so `helm install` only returns once all of them
7-
# have run; 03-assert then waits for GMS to become ready.
7+
# have run; 04-assert then waits for GMS to become ready.
88
#
99
# Two timeouts are needed here:
1010
# * `--timeout` is Helm's wait per individual hook. The default (5m) is not enough for
@@ -17,6 +17,6 @@ commands:
1717
--namespace $NAMESPACE
1818
--version {{ test_scenario['values']['data-hub'] }}
1919
--repo https://helm.datahubproject.io
20-
--values 03_datahub-values.yaml
20+
--values 04_datahub-values.yaml
2121
--timeout 10m
2222
timeout: 1200

tests/templates/kuttl/data-hub-resource-info/03_datahub-values.yaml renamed to tests/templates/kuttl/data-hub-resource-info/04_datahub-values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ global:
1515
datahub:
1616
# THE point of this test: require authentication on every GMS request.
1717
# With this on, GMS returns 401 for unauthenticated calls and only accepts a valid
18-
# bearer token (a DataHub Personal Access Token, minted in 04-mint-pat).
18+
# bearer token (a DataHub Personal Access Token, minted in 05-mint-pat).
1919
metadata_service_authentication:
2020
enabled: true
2121
# Signing key + system client secret are read from `datahub-auth-secrets`
22-
# (created in 02-install-datahub-prerequisites). These are the chart's default
22+
# (created in 03-install-datahub-prerequisites). These are the chart's default
2323
# secretRef names/keys; kept explicit for clarity.
2424
systemClientSecret:
2525
secretRef: datahub-auth-secrets

0 commit comments

Comments
 (0)