Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions tests/templates/kuttl/data-hub-resource-info/01-grant-scc.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{% if test_scenario['values']['openshift'] == 'true' %}
# This test's Pods hardcode runAsUser/fsGroup 1000 (OpenSearch, DataHub) and
# 1001 (Bitnami MySQL/Kafka), and three init containers run as root -- all
# outside the UID range OpenShift assigns to the namespace, so `restricted-v2`
# rejects every Pod.
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: use-integration-tests-scc
rules:
- apiGroups:
- security.openshift.io
resources:
- securitycontextconstraints
resourceNames:
- privileged
verbs:
- use
---
# The charts create their own ServiceAccounts, so most subjects below name
# accounts that do not exist yet: the grant must precede `helm install`, which
# starts workloads right away (`datahub-system-update` runs as a pre-install
# hook).
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: use-integration-tests-scc
subjects:
# OpenSearch and the test's own Jobs run as `default`.
- kind: ServiceAccount
name: default
- kind: ServiceAccount
name: prerequisites-kafka
- kind: ServiceAccount
name: prerequisites-mysql
# datahub-frontend and datahub-gms.
- kind: ServiceAccount
name: datahub-app-sa
# datahub-system-update and datahub-system-update-nonblk.
- kind: ServiceAccount
name: datahub-operator-sa
roleRef:
kind: Role
name: use-integration-tests-scc
apiGroup: rbac.authorization.k8s.io
{% endif %}
12 changes: 0 additions & 12 deletions tests/templates/kuttl/data-hub-resource-info/02-assert.yaml

This file was deleted.

11 changes: 7 additions & 4 deletions tests/templates/kuttl/data-hub-resource-info/03-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
# GMS waits for the system-update bootstrap job (schema + indices) before it goes ready,
# so give this plenty of headroom.
# OpenSearch + Kafka can be slow to become ready on a cold cluster (image pulls, JVM start).
timeout: 900
commands:
- script: kubectl -n $NAMESPACE rollout status --timeout=890s deployment/datahub-datahub-gms
- script: kubectl -n $NAMESPACE rollout status --timeout=890s deployment/datahub-datahub-frontend
# Wait for the stateful prerequisites to be ready before installing DataHub itself.
# (Pod/StatefulSet names come from the `prerequisites` release; adjust if a chart bump
# renames them.)
- script: kubectl -n $NAMESPACE rollout status --timeout=590s statefulset/opensearch-cluster-master
- script: kubectl -n $NAMESPACE rollout status --timeout=590s statefulset/prerequisites-mysql
- script: kubectl -n $NAMESPACE rollout status --timeout=590s statefulset/prerequisites-kafka-controller
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ commands:
--namespace $NAMESPACE
--version {{ test_scenario['values']['data-hub-prerequisites'] }}
--repo https://helm.datahubproject.io
--values 02_datahub-prerequisites-values.yaml
--values 03_datahub-prerequisites-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ opensearch:

mysql:
auth:
# Root password is read from the `mysql-secrets` Secret created in 02-install-datahub-prerequisites.
# Root password is read from the `mysql-secrets` Secret created in 03-install-datahub-prerequisites.
# This is the same Secret the datahub chart reads (its default global.sql.datasource.password).
existingSecret: mysql-secrets
database: datahub
Expand Down
13 changes: 8 additions & 5 deletions tests/templates/kuttl/data-hub-resource-info/04-assert.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
# The credentials Secret for the resource-info-fetcher exists.
apiVersion: v1
kind: Secret
metadata:
name: datahub-rif-credentials
apiVersion: kuttl.dev/v1beta1
kind: TestAssert
# GMS waits for the system-update bootstrap job (schema + indices) before it goes ready,
# so give this plenty of headroom.
timeout: 900
commands:
- script: kubectl -n $NAMESPACE rollout status --timeout=890s deployment/datahub-datahub-gms
- script: kubectl -n $NAMESPACE rollout status --timeout=890s deployment/datahub-datahub-frontend
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: TestStep
commands:
# The chart installs its bootstrap jobs (MySQL schema, Kafka topics, OpenSearch indices,
# `datahub-system-update`) as Helm hooks, so `helm install` only returns once all of them
# have run; 03-assert then waits for GMS to become ready.
# have run; 04-assert then waits for GMS to become ready.
#
# Two timeouts are needed here:
# * `--timeout` is Helm's wait per individual hook. The default (5m) is not enough for
Expand All @@ -17,6 +17,6 @@ commands:
--namespace $NAMESPACE
--version {{ test_scenario['values']['data-hub'] }}
--repo https://helm.datahubproject.io
--values 03_datahub-values.yaml
--values 04_datahub-values.yaml
--timeout 10m
timeout: 1200
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ global:
datahub:
# THE point of this test: require authentication on every GMS request.
# With this on, GMS returns 401 for unauthenticated calls and only accepts a valid
# bearer token (a DataHub Personal Access Token, minted in 04-mint-pat).
# bearer token (a DataHub Personal Access Token, minted in 05-mint-pat).
metadata_service_authentication:
enabled: true
# Signing key + system client secret are read from `datahub-auth-secrets`
# (created in 02-install-datahub-prerequisites). These are the chart's default
# (created in 03-install-datahub-prerequisites). These are the chart's default
# secretRef names/keys; kept explicit for clarity.
systemClientSecret:
secretRef: datahub-auth-secrets
Expand Down
6 changes: 6 additions & 0 deletions tests/templates/kuttl/data-hub-resource-info/05-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# The credentials Secret for the resource-info-fetcher exists.
apiVersion: v1
kind: Secret
metadata:
name: datahub-rif-credentials
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ data:
type: datahub-rest
config:
server: 'http://datahub-datahub-gms:8080'
# Same DataHub PAT the RIF sidecar uses, minted in 04-mint-pat.
# Same DataHub PAT the RIF sidecar uses, minted in 05-mint-pat.
token: '${DATAHUB_GMS_TOKEN}'
---
apiVersion: batch/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ data:
type: datahub-rest
config:
server: 'http://datahub-datahub-gms:8080'
# Same DataHub PAT the RIF sidecar uses, minted in 04-mint-pat.
# Same DataHub PAT the RIF sidecar uses, minted in 05-mint-pat.
token: '${DATAHUB_GMS_TOKEN}'
---
apiVersion: batch/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ data:
type: datahub-rest
config:
server: 'http://datahub-datahub-gms:8080'
# Same DataHub PAT the RIF sidecar uses, minted in 04-mint-pat.
# Same DataHub PAT the RIF sidecar uses, minted in 05-mint-pat.
token: '${DATAHUB_GMS_TOKEN}'
---
apiVersion: batch/v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
# Same DataHub PAT the RIF sidecar uses, minted in 04-mint-pat.
# Same DataHub PAT the RIF sidecar uses, minted in 05-mint-pat.
- name: DATAHUB_GMS_TOKEN
valueFrom:
secretKeyRef:
Expand Down