From 75321575b26b02b59134c6e4c0685e4a3a807573 Mon Sep 17 00:00:00 2001 From: Joshua Landwehr Date: Thu, 1 Oct 2026 11:00:00 -0700 Subject: [PATCH 1/3] Support non-root OpenShift deployments and configurable XGT storage --- .github/workflows/validate.yml | 239 ++++++ README.md | 15 +- charts/rocketgraph/Chart.yaml | 2 +- charts/rocketgraph/README.md | 277 ++++++- .../examples/xgt_existing_files.yaml | 23 + .../rocketgraph/examples/xgt_files/audit.xml | 14 + .../examples/xgt_files/grouplabel.csv | 4 + .../rocketgraph/examples/xgt_files/label.csv | 3 + .../rocketgraph/examples/xgt_files/xgtd.conf | 24 + .../examples/xgt_files_separate_data.yaml | 29 + .../examples/xgt_openshift_restricted.yaml | 48 ++ charts/rocketgraph/templates/NOTES.txt | 19 +- charts/rocketgraph/templates/_helpers.tpl | 28 + charts/rocketgraph/templates/_validation.tpl | 91 ++- .../templates/backend-deployment.yaml | 7 +- .../templates/backend-oidc-secret.yaml | 4 +- charts/rocketgraph/templates/backend-pdb.yaml | 3 + charts/rocketgraph/templates/backend-pvc.yaml | 3 + .../templates/backend-service.yaml | 3 + .../templates/backend-site-configmap.yaml | 3 + .../templates/backend-tls-secret.yaml | 3 + .../templates/frontend-deployment.yaml | 58 +- .../rocketgraph/templates/frontend-pdb.yaml | 3 + .../templates/frontend-service.yaml | 7 +- .../templates/frontend-tls-secret.yaml | 3 + charts/rocketgraph/templates/ingress.yaml | 2 +- .../templates/mongodb-deployment.yaml | 13 +- .../rocketgraph/templates/networkpolicy.yaml | 6 +- charts/rocketgraph/templates/scc.yaml | 2 +- .../rocketgraph/templates/xgt-configmap.yaml | 10 +- .../rocketgraph/templates/xgt-deployment.yaml | 80 +- .../templates/xgt-ldap-secret.yaml | 2 +- .../templates/xgt-license-secret.yaml | 2 +- charts/rocketgraph/templates/xgt-pvc.yaml | 4 +- .../rocketgraph/templates/xgt-tls-secret.yaml | 2 +- .../rocketgraph/tests/snapshots/default.yaml | 625 +++++++++++++++ .../tests/snapshots/external-mongodb.yaml | 473 ++++++++++++ .../tests/snapshots/external-xgt.yaml | 395 ++++++++++ charts/rocketgraph/tests/snapshots/ldap.yaml | 666 ++++++++++++++++ .../tests/snapshots/openshift.yaml | 663 ++++++++++++++++ charts/rocketgraph/tests/snapshots/tls.yaml | 714 ++++++++++++++++++ charts/rocketgraph/tests/test_render.py | 491 ++++++++++++ charts/rocketgraph/values.schema.json | 86 ++- charts/rocketgraph/values.yaml | 39 +- doc/oidc_configuration.md | 147 +++- doc/openshift_fips_deployment.md | 192 +++++ doc/openshift_fips_values.example.yaml | 76 ++ doc/openshift_test_server/.gitignore | 7 + doc/openshift_test_server/README.md | 388 ++++++++++ .../bob_add_admin.ldif.example | 5 + .../bob_remove_admin.ldif.example | 5 + doc/openshift_test_server/ldap_groups.txt | 2 + doc/openshift_test_server/ldap_provider.yaml | 18 + doc/openshift_test_server/ldap_sync.yaml | 104 +++ .../ldap_sync_config.yaml | 31 + doc/openshift_test_server/login.py | 66 ++ .../make_test_certificates.sh | 43 ++ doc/openshift_test_server/namespaces.yaml | 20 + doc/openshift_test_server/oauth_client.yaml | 12 + doc/openshift_test_server/requirements.txt | 1 + doc/openshift_test_server/route.yaml | 15 + doc/openshift_test_server/values.yaml | 103 +++ 62 files changed, 6305 insertions(+), 118 deletions(-) create mode 100644 .github/workflows/validate.yml create mode 100644 charts/rocketgraph/examples/xgt_existing_files.yaml create mode 100644 charts/rocketgraph/examples/xgt_files/audit.xml create mode 100644 charts/rocketgraph/examples/xgt_files/grouplabel.csv create mode 100644 charts/rocketgraph/examples/xgt_files/label.csv create mode 100644 charts/rocketgraph/examples/xgt_files/xgtd.conf create mode 100644 charts/rocketgraph/examples/xgt_files_separate_data.yaml create mode 100644 charts/rocketgraph/examples/xgt_openshift_restricted.yaml create mode 100644 charts/rocketgraph/tests/snapshots/default.yaml create mode 100644 charts/rocketgraph/tests/snapshots/external-mongodb.yaml create mode 100644 charts/rocketgraph/tests/snapshots/external-xgt.yaml create mode 100644 charts/rocketgraph/tests/snapshots/ldap.yaml create mode 100644 charts/rocketgraph/tests/snapshots/openshift.yaml create mode 100644 charts/rocketgraph/tests/snapshots/tls.yaml create mode 100644 charts/rocketgraph/tests/test_render.py create mode 100644 doc/openshift_fips_deployment.md create mode 100644 doc/openshift_fips_values.example.yaml create mode 100644 doc/openshift_test_server/.gitignore create mode 100644 doc/openshift_test_server/README.md create mode 100644 doc/openshift_test_server/bob_add_admin.ldif.example create mode 100644 doc/openshift_test_server/bob_remove_admin.ldif.example create mode 100644 doc/openshift_test_server/ldap_groups.txt create mode 100644 doc/openshift_test_server/ldap_provider.yaml create mode 100644 doc/openshift_test_server/ldap_sync.yaml create mode 100644 doc/openshift_test_server/ldap_sync_config.yaml create mode 100644 doc/openshift_test_server/login.py create mode 100644 doc/openshift_test_server/make_test_certificates.sh create mode 100644 doc/openshift_test_server/namespaces.yaml create mode 100644 doc/openshift_test_server/oauth_client.yaml create mode 100644 doc/openshift_test_server/requirements.txt create mode 100644 doc/openshift_test_server/route.yaml create mode 100644 doc/openshift_test_server/values.yaml diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml new file mode 100644 index 0000000..1909d10 --- /dev/null +++ b/.github/workflows/validate.yml @@ -0,0 +1,239 @@ +#===----------------------------------------------------------------------===# +# +# Copyright 2016-2026 Trovares Inc. dba Rocketgraph. All rights reserved. +# +#===----------------------------------------------------------------------===# + +name: Validate Helm Chart + +on: + push: + branches: [ main, ci-testing ] + paths: + - 'charts/**' + - 'doc/openshift_test_server/**' + - 'doc/openshift_fips_values.example.yaml' + - '.github/workflows/validate.yml' + pull_request: + branches: [ main ] + paths: + - 'charts/**' + - 'doc/openshift_test_server/**' + - 'doc/openshift_fips_values.example.yaml' + - '.github/workflows/validate.yml' + workflow_dispatch: + +permissions: + contents: read + +env: + HELM_VERSION: v4.2.4 + +jobs: + helm-lint: + name: Helm Lint + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v6 + + - name: Set up Helm + uses: azure/setup-helm@v5 + with: + version: ${{ env.HELM_VERSION }} + + - name: Lint chart + run: helm lint charts/rocketgraph + + helm-template: + name: Helm Template + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v6 + + - name: Set up Helm + uses: azure/setup-helm@v5 + with: + version: ${{ env.HELM_VERSION }} + + - name: Template with defaults + run: helm template test-release charts/rocketgraph + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.12' + + - name: Test OpenShift profiles, storage and shared Mission Control + run: | + python -m pip install PyYAML==6.0.3 + python -m unittest discover -s charts/rocketgraph/tests -v + + - name: Template with all features enabled + run: | + helm template test-release charts/rocketgraph \ + --set frontend.tls.publicCert="test" \ + --set frontend.tls.privateKey="test" \ + --set frontend.tls.certChain="test" \ + --set backend.tls.xgtServerCert="test" \ + --set backend.tls.proxyClientCert="test" \ + --set backend.tls.proxyClientKey="test" \ + --set backend.tls.mtls=true \ + --set backend.odbc.enabled=true \ + --set backend.iaccess.enabled=true \ + --set backend.siteConfig.yml="test: true" \ + --set backend.siteConfig.py="pass" \ + --set mongodb.auth.enabled=true \ + --set mongodb.auth.rootPassword="pass" \ + --set xgt.ssl.enabled=true \ + --set xgt.ssl.cert="test" \ + --set xgt.ssl.key="test" \ + --set xgt.ssl.mtls=true \ + --set xgt.ssl.caCert="test" \ + --set xgt.license.data="test" \ + --set xgt.ldap.enabled=true \ + --set xgt.ldap.uri="ldap://test" \ + --set xgt.ldap.baseDn="dc=test" \ + --set openshift.enabled=true \ + --set networkPolicy.enabled=true + + - name: Template with existingSecret paths + run: | + helm template test-release charts/rocketgraph \ + --set frontend.tls.existingSecret="frontend-tls" \ + --set backend.tls.existingSecret="backend-tls" \ + --set mongodb.auth.enabled=true \ + --set mongodb.auth.existingSecret="mongo-auth" \ + --set xgt.ssl.enabled=true \ + --set xgt.ssl.existingSecret="xgt-ssl" \ + --set xgt.license.existingSecret="xgt-license" + + helm-snapshot: + name: Helm Snapshot + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v6 + + - name: Set up Helm + uses: azure/setup-helm@v5 + with: + version: ${{ env.HELM_VERSION }} + + # Checksums depend on line endings (CRLF vs LF) so we strip them before comparing. + - name: Snapshot — default + run: | + helm template test-release charts/rocketgraph > /tmp/default.yaml + diff <(grep -v 'checksum/' charts/rocketgraph/tests/snapshots/default.yaml) <(grep -v 'checksum/' /tmp/default.yaml) + + - name: Snapshot — tls + run: | + helm template test-release charts/rocketgraph \ + --set frontend.tls.publicCert="test-cert" \ + --set frontend.tls.privateKey="test-key" \ + --set backend.tls.xgtServerCert="test-ca" \ + --set backend.tls.proxyClientCert="test-client-cert" \ + --set backend.tls.proxyClientKey="test-client-key" \ + --set xgt.ssl.enabled=true \ + --set xgt.ssl.cert="test-xgt-cert" \ + --set xgt.ssl.key="test-xgt-key" \ + --set backend.env.XGT_SERVER_CN="test-release-xgt" \ + > /tmp/tls.yaml + diff <(grep -v 'checksum/' charts/rocketgraph/tests/snapshots/tls.yaml) <(grep -v 'checksum/' /tmp/tls.yaml) + + - name: Snapshot — ldap + run: | + helm template test-release charts/rocketgraph \ + --set xgt.ldap.enabled=true \ + --set xgt.ldap.uri="ldap://ldap.example.org" \ + --set "xgt.ldap.baseDn=dc=example\,dc=org" \ + --set "xgt.ldap.bindDn=cn=admin\,dc=example\,dc=org" \ + --set-string xgt.ldap.bindPassword="secret" \ + > /tmp/ldap.yaml + diff <(grep -v 'checksum/' charts/rocketgraph/tests/snapshots/ldap.yaml) <(grep -v 'checksum/' /tmp/ldap.yaml) + + - name: Snapshot — openshift + run: | + helm template test-release charts/rocketgraph \ + --set openshift.enabled=true \ + > /tmp/openshift.yaml + diff <(grep -v 'checksum/' charts/rocketgraph/tests/snapshots/openshift.yaml) <(grep -v 'checksum/' /tmp/openshift.yaml) + + - name: Snapshot — external-mongodb + run: | + helm template test-release charts/rocketgraph \ + --set mongodb.enabled=false \ + --set mongodb.externalUri="mongodb://user:pass@external-host:27017/dbname" \ + > /tmp/external-mongodb.yaml + diff <(grep -v 'checksum/' charts/rocketgraph/tests/snapshots/external-mongodb.yaml) <(grep -v 'checksum/' /tmp/external-mongodb.yaml) + + - name: Snapshot — external-xgt + run: | + helm template test-release charts/rocketgraph \ + --set xgt.enabled=false \ + --set backend.env.MC_DEFAULT_XGT_HOST=xgt.example.com \ + > /tmp/external-xgt.yaml + diff <(grep -v 'checksum/' charts/rocketgraph/tests/snapshots/external-xgt.yaml) <(grep -v 'checksum/' /tmp/external-xgt.yaml) + + kubeconform: + name: Kubeconform + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: actions/checkout@v6 + + - name: Set up Helm + uses: azure/setup-helm@v5 + with: + version: ${{ env.HELM_VERSION }} + + - name: Install kubeconform + run: | + curl -fsSL https://github.com/yannh/kubeconform/releases/latest/download/kubeconform-linux-amd64.tar.gz \ + | tar xz -C /usr/local/bin kubeconform + + - name: Validate rendered manifests + run: | + helm template test-release charts/rocketgraph \ + | kubeconform -strict -summary -output text + + helm-smoke: + name: Helm Smoke Test + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v6 + + - name: Set up Helm + uses: azure/setup-helm@v5 + with: + version: ${{ env.HELM_VERSION }} + + - name: Create kind cluster + uses: helm/kind-action@v1 + + - name: Install chart + run: helm install test-release charts/rocketgraph --wait --timeout 5m + + - name: Verify all pods are ready + run: | + kubectl get pods + kubectl wait --for=condition=ready pod --all --timeout=300s + + - name: Check for excessive restarts + run: | + RESTARTS=$(kubectl get pods -o jsonpath='{.items[*].status.containerStatuses[*].restartCount}') + echo "Restart counts: $RESTARTS" + for count in $RESTARTS; do + if [ "$count" -gt 2 ]; then + echo "Pod has $count restarts" + kubectl get pods + kubectl describe pods + exit 1 + fi + done + + - name: Teardown + if: always() + run: kind delete cluster diff --git a/README.md b/README.md index 88335c8..4c06821 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,13 @@ The guides below cover individual topics in depth. The first four apply to ever | Guide | What it covers | |---|---| | [MongoDB Security](doc/mongodb_security.md) | Authentication, TLS, mutual TLS, and encryption at rest for the bundled MongoDB | -| [OIDC Authentication](doc/oidc_configuration.md) | Signing users in through an external identity provider such as Keycloak or OpenShift | +| [OIDC and OpenShift OAuth2 Authentication](doc/oidc_configuration.md) | Keycloak OIDC and OpenShift OAuth2 login, client secrets, scopes and token validation | | [Site LLM Configuration](doc/llm_site_config.md) | Which AI models Mission Control offers, their endpoints, and their credentials | | [ODBC Configuration](doc/odbc_configuration.md) | Loading data from external databases — PostgreSQL, MariaDB, and IBM i (AS/400) | | [Deployment Reference](doc/deployment_reference.md) | Per-container images, ports, volume paths, and environment variables — for orchestrators not listed above, or for debugging a running container | | [Helm Chart](charts/rocketgraph/README.md) | Deploying on Kubernetes and OpenShift, and every value the chart accepts | +| [OpenShift Test Server](doc/openshift_test_server/README.md) | Step-by-step LDAP/OAuth setup, group synchronization, FIPS images, automation tokens, and three XGT servers sharing Mission Control | +| [OpenShift FIPS Deployment Planning](doc/openshift_fips_deployment.md) | Administrator responsibilities, required inputs, and deployment acceptance checks | ## Compose Files and Images @@ -256,10 +258,10 @@ The configurable environment variables are: |Variable |Volume Mapped|Description| |------------------------|-|-----------| -|MC_OIDC_ISSUER | |*(experimental)* OIDC issuer URL; if empty, discovered from the xGT server| +|MC_OIDC_ISSUER | |*(experimental)* OIDC provider or OpenShift OAuth issuer URL; if empty, discovered from XGT| |MC_OIDC_CLIENT_ID | |*(experimental)* OAuth2 client ID; if empty, discovered from the xGT server| |MC_OIDC_CLIENT_SECRET | |*(experimental)* client secret for confidential OAuth2 clients| -|MC_OIDC_SCOPES | |*(experimental)* space-separated OAuth2 scopes to request; default: `openid profile email`| +|MC_OIDC_SCOPES | |*(experimental)* optional scope override; discovers XGT-advertised scopes, including `user:info` for OpenShift| |MC_OIDC_FRONTEND_URL | |*(experimental)* override the frontend base URL for post-login redirects; derived server-side from the request hostname and `MC_PORT`/`MC_SSL_PORT` by default| |MC_OIDC_REDIRECT_URI | |*(experimental)* override the redirect URI sent to the IdP; derived server-side from the request hostname and `MC_PORT`/`MC_SSL_PORT` by default| |MC_OIDC_ALLOWED_ORIGINS | |*(experimental)* comma-separated list of permitted frontend origins; `*` wildcards supported (e.g. `https://*.apps.cluster.example.com`); optional defense-in-depth| @@ -562,9 +564,10 @@ Refer to these detailed [instructions](doc/llm_site_config.md). ### OIDC Authentication (Experimental) -Mission Control has experimental support for authenticating users via an -external OpenID Connect (OIDC) identity provider such as Keycloak or -OpenShift OAuth. +Mission Control has experimental support for OIDC providers such as Keycloak +and for OpenShift's built-in OAuth2 server. Both use the existing `OidcAuth` +interface and `MC_OIDC_*` settings. For OpenShift, XGT obtains the user's identity +and groups by validating the access token through the OpenShift User API. Refer to the [OIDC configuration guide](doc/oidc_configuration.md) for setup instructions. diff --git a/charts/rocketgraph/Chart.yaml b/charts/rocketgraph/Chart.yaml index 2f169ec..2e9ad00 100644 --- a/charts/rocketgraph/Chart.yaml +++ b/charts/rocketgraph/Chart.yaml @@ -2,5 +2,5 @@ apiVersion: v2 name: rocketgraph description: Rocketgraph Mission Control with xGT icon: https://rocketgraph.com/wp-content/uploads/2025/02/R-logo-color.png -version: 0.3.0 +version: 0.4.0 appVersion: "2.7.0" diff --git a/charts/rocketgraph/README.md b/charts/rocketgraph/README.md index bca48e7..1c14933 100644 --- a/charts/rocketgraph/README.md +++ b/charts/rocketgraph/README.md @@ -44,7 +44,7 @@ helm install rocketgraph ./charts/rocketgraph helm install rocketgraph ./charts/rocketgraph --set openshift.enabled=true ``` -This binds the release ServiceAccount to the `anyuid` SCC. OpenShift's default SCC (`restricted-v2`) runs every container as a random unprivileged UID, and the current Mission Control images cannot run that way: the frontend's nginx runs as root to bind port 80 inside its container, the backend image runs as root, and Percona MongoDB (FIPS deployments) requires its fixed uid 1001. Without `openshift.enabled=true`, pods fail at startup. `anyuid` lets each image run as the user it declares — this is the justification to give a cluster security review that asks why the application needs it. If all your images declare a non-root `USER` without a fixed UID, you can use the less-privileged `nonroot` SCC instead: +This binds the release ServiceAccount to the `anyuid` SCC. The full stack's current startup configuration includes root and fixed-UID containers. Have the platform administrator review this permission. `anyuid` and FIPS address different requirements: selecting FIPS images does not require granting `anyuid`. For Mission Control, MongoDB and XGT, use the [restricted-v2 profile](#full-stack-with-openshift-restricted-v2) below. If your images and startup configuration support non-root execution, including any required fixed UID, the `nonroot` SCC is another option subject to cluster policy: ```bash helm install rocketgraph ./charts/rocketgraph --set openshift.enabled=true --set openshift.scc=nonroot @@ -57,6 +57,62 @@ oc expose svc/-frontend oc get route -frontend -o jsonpath='{.spec.host}' ``` +### Full Stack with OpenShift restricted-v2 + +In chart 0.4.0, add this to your site values to run XGT, Mission Control and MongoDB without an `anyuid` grant: + +```yaml +openshift: + enabled: true + scc: restricted-v2 +fips: + enabled: true +``` + +Mission Control currently requires `fips.enabled=true` with this profile. Helm rejects the non-FIPS combination because that frontend image uses different startup and writable paths. This requirement does not apply to XGT-only releases. + +The chart creates a ServiceAccount, drops all capabilities, disables privilege escalation, selects `RuntimeDefault` seccomp and requires non-root execution. OpenShift supplies the namespace UID and volume group. Do not set fixed `runAsUser`, `runAsGroup`, `fsGroup` or `supplementalGroups` for active components. The bundled License Manager and in-container SSSD are not supported by this profile. Supply an XGT license file or external license server as described below. + +Verify the admitted SCC after deployment. Helm does not remove SCC grants created separately by an administrator; a remaining broader grant can change which SCC admits the pods: + +```bash +oc -n get pods -l app.kubernetes.io/instance= \ + -o custom-columns='NAME:.metadata.name,SCC:.metadata.annotations.openshift\.io/scc,UID:.spec.containers[0].securityContext.runAsUser' +``` + +Mission Control's frontend gets writable nginx runtime directories and listens on **8080/8443** inside its container. The Service still exposes its configured HTTP/HTTPS ports (80/443 by default), so existing Routes and Ingresses continue to target the Service. NetworkPolicies and health checks use the new container ports. HTTP, HTTPS and frontend mTLS retain the image's configuration generation, with the listeners adjusted before nginx starts. External redirects use `backend.env.MC_SSL_PORT` when supplied, otherwise the frontend Service's HTTPS port. Proxy headers use the frontend Service port, not the internal 8080/8443 listener; configure `backend.oidc.frontendUrl` for the actual public URL. + +Backend and MongoDB retain their normal entrypoints. MongoDB's encryption-key init container also uses the assigned UID; the chart does not inject UID/GID 1001 in this profile. Use fresh PVCs or arrange an ownership migration for existing storage before enabling it. Optional backend plugin installation and custom ODBC mounts may need additional writable paths or prebuilt images; the profile does not make arbitrary package installation directories writable. + +The [OpenShift test-server values](../../doc/openshift_test_server/values.yaml) use this profile with FIPS images, XGT TLS and MongoDB TLS. Replace their site-specific values and create the referenced Secrets before deploying. The tested image versions are XGT `2.7.1-fips`, Mission Control `2.7.0-fips` and Percona MongoDB `8.0.23`; custom images must support the same startup paths. Default installs keep the existing behavior unless this profile is explicitly selected. + +### xGT with OpenShift restricted-v2 + +The same profile supports an **XGT-only release** with the namespace-assigned UID and group. Start with [`examples/xgt_openshift_restricted.yaml`](examples/xgt_openshift_restricted.yaml), edit the hostname, OAuth endpoints and group mappings, and create its referenced Secrets in the same namespace: + +```bash +oc -n xgt create secret generic xgt-license --from-file=xgtd.lic=/path/to/license.lic +oc -n xgt create secret generic xgt-ssl \ + --from-file=server.cert.pem=/path/to/server.cert.pem \ + --from-file=server.key.pem=/path/to/server.key.pem +oc -n xgt create secret generic oidc-ca --from-file=oidc-ca.pem=/path/to/oidc-ca.pem +helm upgrade --install xgt-test ./charts/rocketgraph -n xgt \ + -f charts/rocketgraph/examples/xgt_openshift_restricted.yaml +``` + +The namespace must already exist, and the certificates and license must match your deployment. The example selects XGT `2.7.1-fips`, disables Mission Control and MongoDB, and sets `openshift.scc: restricted-v2`. This creates a ServiceAccount without an elevated SCC binding. The chart drops capabilities, disables privilege escalation, selects `RuntimeDefault` seccomp, and leaves UID/GID allocation to OpenShift. Do not supply fixed `runAsUser`, `runAsGroup` or `fsGroup` values for this profile. + +The chart starts `/opt/xgtd/bin/xgtd` directly. This bypasses the image entrypoint's configuration-copying steps, which need permissions unavailable to an arbitrary UID. Supply a readable license through a Secret, the files PVC described below, or an external license server. The bundled license in the 2.7.1 image is behind a directory an arbitrary UID cannot traverse. In-container SSSD and the bundled License Manager are outside this profile; use OpenShift OAuth or Keycloak for LDAP-backed authentication. + +Check the actual admission result after deployment: + +```bash +oc -n xgt get pods -l app=xgt \ + -o custom-columns='NAME:.metadata.name,SCC:.metadata.annotations.openshift\.io/scc,UID:.spec.containers[0].securityContext.runAsUser' +``` + +This profile does not establish FIPS compliance for the complete deployment; the cluster, TLS configuration and other components still need the appropriate configuration. + ### FIPS Mode Set `fips.enabled=true` to use FIPS-compliant images in one step: @@ -83,7 +139,7 @@ It makes the following changes: - **MongoDB TLS** — see [MongoDB TLS](#mongodb-tls). With `fips.enabled`, `--tlsFIPSMode` is added automatically when TLS is on. - **Encryption at rest** — see [MongoDB Encryption at Rest](#mongodb-encryption-at-rest). -On OpenShift, the [OpenShift](#openshift) note about Percona's fixed uid 1001 applies — the default `anyuid` SCC binding handles it. +On OpenShift, the [restricted-v2 profile](#full-stack-with-openshift-restricted-v2) runs Percona with a namespace-assigned UID. Existing storage must be accessible to that identity; do not assume ownership from an earlier deployment will work unchanged. ### With xGT License (direct file) @@ -100,6 +156,116 @@ Or pass it inline: helm install rocketgraph ./charts/rocketgraph --set-file xgt.license.data=/path/to/xgtd.lic ``` +`xgt.license.data` means the license file's text, not database data or base64. Prefer `existingSecret` when another system manages the license; leave `data` empty in that case. + +### Bring Your Own xGT Files + +By default, the chart generates configuration in a ConfigMap, mounts license/TLS Secrets, and uses separate data/log PVCs. To manage all XGT files on an existing PVC, use [`examples/xgt_existing_files.yaml`](examples/xgt_existing_files.yaml). It selects the claim `xgt-files` and the optional parent directory `xgt-prod`: + +```yaml +xgt: + hostname: xgt-prod-0 + files: + existingClaim: xgt-files + subPath: xgt-prod +``` + +Pre-populate the claim with this layout. Remove the `xgt-prod/` parent if `subPath` is empty: + +```text +xgt-prod/ + conf/ + xgtd.conf + audit.xml + grouplabel.csv + label.csv + oidc-ca.pem + ssl/certs/server.cert.pem + ssl/private/server.key.pem + license/xgtd.lic + data/ + log/ +``` + +The four directories mount at `/conf`, `/license`, `/data` and `/log`. Configuration and license mounts are read-only. Copy and edit the [example configuration files](examples/xgt_files/), then supply your license and certificates. The example configuration enables TLS and OpenShift OAuth. The storage administrator must make the configuration, keys and license readable by the pod's assigned group, and data/log directories writable. Storage must support the pod's permissions and access mode; an existing claim is not automatically portable between nodes or namespaces. + +```bash +helm upgrade --install xgt-prod ./charts/rocketgraph -n xgt \ + -f charts/rocketgraph/examples/xgt_existing_files.yaml +``` + +In this mode, the chart creates no XGT configuration, license/TLS Secrets, or data/log PVCs. It starts XGT directly and reads the supplied files. Configure TLS, OAuth, memory and label mappings in `xgtd.conf` and the other files; `xgt.extraConfig` and inline configuration do not apply. The chart rejects conflicting sources rather than silently ignoring them. Use the complete example on its own, not layered over a values file containing those sources. `xgt.hostname`, image, resources, service port and health-check settings still apply. Keep XGT's configured memory below the container limit. + +To keep data and/or logs on separate existing PVCs, set the corresponding `xgt.persistence` claims. Each override takes precedence over that directory on the common files PVC: + +```yaml +xgt: + files: + existingClaim: xgt-files + subPath: xgt-prod # Optional; applies only to this claim. + persistence: + data: + existingClaim: xgt-data + log: + existingClaim: xgt-logs +``` + +Here, `xgt-prod/conf` and `xgt-prod/license` come from `xgt-files`, while the roots of `xgt-data` and `xgt-logs` mount at `/data` and `/log`. All claims must already exist in the release namespace. The chart does not create these PVCs or copy data between them. + +| Existing-claim overrides | Directories kept on the common files PVC | +| --- | --- | +| Neither | `conf`, `license`, `data`, `log` | +| Data only | `conf`, `license`, `log` | +| Logs only | `conf`, `license`, `data` | +| Both | `conf`, `license` | + +Only prepare the directories that remain on the common claim. Omit or clear an override to use that directory on the common claim again. See [`examples/xgt_files_separate_data.yaml`](examples/xgt_files_separate_data.yaml) for a complete example with just data separated. Plan file migration before changing claims on an existing release. + +After changing configuration on the PVC, explicitly restart XGT: + +```bash +oc -n xgt rollout restart deployment/xgt-prod-xgt +``` + +`/data` remains writable for loading and saving data as the assigned non-root user. For example, copy a CSV to the running server and load it into an existing frame from Python: + +```bash +oc -n xgt exec -i deployment/xgt-prod-xgt -- sh -c 'cat > /data/people.csv' < people.csv +``` + +```python +frame.load("xgtd://people.csv") +``` + +Server paths are relative to the configured `/data` directory. Files on its PVC survive pod replacement; this does not automatically persist XGT's in-memory frames. Use the [data loading and saving APIs](https://docs.rocketgraph.com/user_ref/graphanalytics/data.html) for that. + +For independent servers, use separate claims, or separate parent directories with storage that supports the required concurrent mounts. Never share the same data directory. Helm does not manage or delete an existing claim, and rolling back Helm does not roll back files on it. Changing an existing release from generated files to this mode requires a data migration and PVC retention plan before upgrading. + +To manage only configuration externally, set `xgt.config.existingConfigMap` instead. It must contain `xgtd.conf`, `audit.xml`, `grouplabel.csv` and `label.csv`; other file mounts remain managed as usual. Set paths for license, TLS and OAuth CA in that configuration and restart after updates. In particular, a mounted license Secret is at `/license/xgtd.lic` and the OAuth CA mount is at `/etc/ssl/certs/oidc-ca.pem`. + +### xGT Startup and Additional Mounts + +Use values for deployment customizations so they can be reused on upgrades without editing templates: + +```yaml +xgt: + env: + - name: SITE_NAME + value: example + extraVolumes: + - name: imports + persistentVolumeClaim: + claimName: imports + extraVolumeMounts: + - name: imports + mountPath: /data/imports + readOnly: true +``` + +`xgt.command` and `xgt.args` accept Kubernetes command/argument lists. With a custom command, supply its complete arguments. Otherwise, `args` appends to the direct-start arguments in the restricted/PVC profiles, or is passed to the image entrypoint in the default profile. A custom command must preserve startup and health-port behavior. Extra mounts must use distinct names/paths and cannot replace chart mounts; use the existing-configuration or files-PVC options for that purpose. + +Keep per-release settings in version-controlled values files and pass them again to `helm upgrade`. Review release notes and rendered manifests before upgrading. If you modify chart templates instead, maintain a fork and merge upstream changes yourself; Helm does not merge customer template edits into an upstream chart. + ### With xGT License Manager The License Manager is a standalone service that serves license files to xGT over port 6200, supporting multiple licenses and multiple xGT replicas. When enabled, `license.location` in xgtd.conf is set automatically. @@ -423,6 +589,47 @@ helm install rocketgraph ./charts/rocketgraph \ --set backend.env.MC_DEFAULT_XGT_PORT=4367 ``` +### Separate xGT Releases with Fixed Hostnames + +For a complete OpenShift LDAP/OAuth walkthrough with YAML and commands, see the [test-server guide](../../doc/openshift_test_server/README.md). + +Chart **0.4.0** adds `xgt.hostname` and `missionControl.enabled`. A fixed container hostname supports a hostname-bound license while keeping xGT managed by Helm: + +```yaml +xgt: + enabled: true + hostname: xgt-test-0 + license: + existingSecret: xgt-license +``` + +The workload remains a one-replica Deployment. Kubernetes generates its pod name, while the operating-system hostname inside the container is `xgt-test-0`, including after pod replacement. This setting does not create a DNS endpoint: clients use the release's Service, such as `rocketgraph-xgt:4367`. Verify the hostname with: + +```bash +oc exec deployment/rocketgraph-xgt -- cat /proc/sys/kernel/hostname +``` + +For three independent servers, install one release per server. Start with the full test stack, then disable Mission Control and MongoDB in additional releases: + +```bash +helm upgrade --install rocketgraph ./charts/rocketgraph -n xgt \ + -f site-values.yaml --set xgt.hostname=xgt-test-0 + +helm upgrade --install xgt-dev ./charts/rocketgraph -n xgt \ + -f site-values.yaml --set xgt.hostname=xgt-dev-0 \ + --set missionControl.enabled=false --set mongodb.enabled=false + +helm upgrade --install xgt-prod ./charts/rocketgraph -n xgt \ + -f site-values.yaml --set xgt.hostname=xgt-prod-0 \ + --set missionControl.enabled=false --set mongodb.enabled=false +``` + +Create the namespace and referenced Secrets first. Keep `xgt.enabled=true` in all three releases. Each gets separate xGT configuration, Services and chart-created PVCs; avoid sharing an `existingClaim` between independent servers. Keep these settings on upgrades, preferably in per-release values files. Deleting a release also deletes its chart-created PVCs; plan backups and retention for persistent data. + +The test release's Mission Control can connect to all three endpoints. Set its `backend.oidc.xgtAllowedHosts` to `rocketgraph-xgt:4367,xgt-dev-xgt:4367,xgt-prod-xgt:4367`. Provide licenses covering the chosen hostnames and TLS certificates covering the Service names. Mission Control must trust their issuing CAs; leave `backend.env.XGT_SERVER_CN` unset so each endpoint is checked against its own name. + +`missionControl.enabled=false` suppresses frontend/backend workloads and their resources, but does not disable MongoDB automatically. xGT-only releases still honor `backend.oidc.caCertExistingSecret` or `backend.oidc.caCert` for the shared OIDC CA mount. All normal `xgt.*` settings continue to apply. + ### LDAP Authentication xGT supports LDAP authentication via PAM/SSSD. When enabled, the chart mounts an SSSD @@ -539,41 +746,66 @@ xgtd,xgtadmin xgtadmin ### OIDC Authentication -To enable OIDC login, set `XGT_AUTH_TYPES` and configure the xGT OIDC section. -In most cases the backend discovers the issuer and client ID automatically from xGT — -no `backend.oidc.*` overrides are needed. +The existing `OidcAuth` option supports both standard OIDC providers such as +Keycloak and **OpenShift OAuth2**. OpenShift's built-in OAuth server uses the +authorization-code flow; XGT validates its access tokens and reads identity and +groups through the OpenShift User API. Keep the `security.oidc`, `backend.oidc` +and `MC_OIDC_*` configuration names for both integrations. + +To enable OIDC login, set `backend.env.XGT_AUTH_TYPES` and configure `xgt.extraConfig.security.oidc`. The backend discovers the issuer, client ID, and scopes from xGT when the issuer or client ID is unset. Supply confidential-client secrets and private CA certificates separately. Override the client ID when Mission Control has its own client; override `frontendUrl` only when the derived public URL is wrong. See the [OIDC configuration guide](../../doc/oidc_configuration.md) for how the redirect URI is derived, the full environment-variable reference, and the security allowlists (`MC_XGT_ALLOWED_HOSTS`, `MC_OIDC_ALLOWED_ORIGINS`) — that guide includes Kubernetes and OpenShift examples, such as the wildcard patterns needed for StatefulSet pod hostnames and cluster subdomains. #### Keycloak +Register a confidential client named `mission-control` with Standard flow enabled and callback `https://mc.example.com/api/login/oidc/callback`. Store its secret in `mission-control-oidc` under key `MC_OIDC_CLIENT_SECRET`. Keep the Python browser client `xgtd-client` public with PKCE `S256` and callback `http://127.0.0.1:8765/callback`. Mission Control 2.7.0 does not send PKCE, so do not require it on the confidential client. + ```yaml backend: env: XGT_AUTH_TYPES: "['OidcAuth']" + MC_DEFAULT_XGT_PORT: '4367' + oidc: + clientId: mission-control + existingSecret: mission-control-oidc xgt: extraConfig: security.oidc: - validation_mode: introspection + validation_mode: jwt issuer: https://idp.example.com/realms/xgt - jwks_uri: https://idp.example.com/realms/xgt/protocol/openid-connect/certs audience: xgtd-client client_id: xgtd-client username_claim: preferred_username groups_claim: groups - introspection_client_id: xgtd-introspection - introspection_client_secret: + scopes: openid profile email ``` +Both clients need Group Membership and Audience mappers in their access tokens, with audience `xgtd-client` and claim `groups`. The backend discovers the issuer and scopes from xGT while using its own client ID. Add private-CA settings below if needed. For upstream HTTPS termination, set `frontend.tls.external: true`; if proxy headers produce the wrong origin, also set `backend.oidc.frontendUrl` to the public HTTPS URL. + #### OpenShift OAuth +This is OAuth2 authentication through `OidcAuth`, with +`validation_mode: openshift_userapi`. Mission Control needs the OAuthClient's +secret to exchange authorization codes for tokens. XGT validates the resulting +tokens through the User API and does not need that client secret. The +OAuthClient's name is the client ID; `existingSecret` below instead names the +Kubernetes Secret containing the client secret. + ```yaml +frontend: + tls: + external: true # HTTPS terminates at the edge Route. backend: env: XGT_AUTH_TYPES: "['OidcAuth']" + MC_DEFAULT_XGT_PORT: '4367' oidc: - tlsVerify: "false" # or provide caCertExistingSecret + existingSecret: openshift-oauth-client + caCertExistingSecret: oidc-ca + tlsVerify: /etc/ssl/certs/oidc-ca.pem + # Set only if the proxy derives the wrong public origin: + frontendUrl: https://mc.apps.cluster.example.com xgt: extraConfig: @@ -587,7 +819,9 @@ xgt: groups_claim: groups ``` -The OAuthClient must have `https:///api/login/oidc/callback` in its `redirectURIs` list. +Create `openshift-oauth-client` with key `MC_OIDC_CLIENT_SECRET`, matching the OAuthClient's secret. Create `oidc-ca` as shown below, with a CA bundle that trusts both the OAuth and User API endpoints. The OAuthClient must allow `user:info` in `scopeRestrictions` and contain `https://mc.apps.cluster.example.com/api/login/oidc/callback` in `redirectURIs`. Include the Python loopback callback if that client also uses this OAuthClient. + +Issuer, client ID, and `user:info` are discovered from xGT. The callback is derived from the public frontend URL, so `redirectUri` need not also be set. Omit the CA settings when the endpoints are already trusted. See the [OIDC guide](../../doc/oidc_configuration.md#ldap-groups-and-automated-accounts) for LDAP group synchronization, automation, and login verification. #### CA Certificates @@ -603,8 +837,11 @@ kubectl create secret generic oidc-ca --from-file=oidc-ca.pem=/path/to/ca.pem -n backend: oidc: caCertExistingSecret: oidc-ca + tlsVerify: /etc/ssl/certs/oidc-ca.pem ``` +The mount supplies the certificate file; `tlsVerify` selects that file for backend HTTPS verification. Both are needed when the CA is not already trusted. + ### Site Configuration The backend supports site configuration files for customizing LLM providers, models, @@ -777,8 +1014,8 @@ The Ingress routes to the frontend service on port 80. The ingress controller te | `backend.oidc.clientId` | Override OAuth2 client ID (auto-discovered from xGT if empty) | `""` | | `backend.oidc.clientSecret` | Client secret — inline value creates a Secret | `""` | | `backend.oidc.existingSecret` | Existing Secret with key `MC_OIDC_CLIENT_SECRET` | `""` | -| `backend.oidc.scopes` | Space-separated OAuth2 scopes | `""` | -| `backend.oidc.frontendUrl` | Override frontend base URL for post-login redirects | `""` | +| `backend.oidc.scopes` | Optional scope override; uses xGT-advertised scopes during discovery when empty | `""` | +| `backend.oidc.frontendUrl` | Override public frontend origin for post-login redirects and the derived callback | `""` | | `backend.oidc.redirectUri` | Override redirect URI sent to the IdP | `""` | | `backend.oidc.allowedOrigins` | Comma-separated allowed origins (defense-in-depth, optional) | `""` | | `backend.oidc.tlsVerify` | `true`, `false`, or path to CA bundle for OIDC HTTP calls | `""` | @@ -827,6 +1064,15 @@ The Ingress routes to the frontend service on port 80. The ingress controller te | Parameter | Description | Default | |-----------------------------|--------------------------------------|----------------| | `xgt.enabled` | Deploy xGT as part of the release | `true` | +| `xgt.hostname` | Fixed container OS hostname for licensing; does not change the pod or Service name | `""` | +| `xgt.files.existingClaim` | Common PVC for conf/license/data/log; separate data/log existing claims override their mounts | `""` | +| `xgt.files.subPath` | Optional relative parent directory on the common files PVC; does not apply to separate data/log claims | `""` | +| `xgt.persistence.data.existingClaim` | Existing data PVC mounted at `/data`; takes precedence over the files PVC | `""` | +| `xgt.persistence.log.existingClaim` | Existing log PVC mounted at `/log`; takes precedence over the files PVC | `""` | +| `xgt.config.existingConfigMap` | Existing complete configuration ConfigMap | `""` | +| `xgt.command` / `xgt.args` | Container command override / arguments | `[]` | +| `xgt.env` | Additional Kubernetes environment entries | `[]` | +| `xgt.extraVolumes` / `xgt.extraVolumeMounts` | Additional Kubernetes volumes / container mounts | `[]` | | `xgt.config.grouplabelCsv` | Override grouplabel.csv contents | `""` | | `xgt.config.labelCsv` | Override label.csv contents | `""` | | `xgt.extraConfig` | Extra xgtd.conf key-value overrides | `{}` | @@ -845,11 +1091,12 @@ The Ingress routes to the frontend service on port 80. The ingress controller te | Parameter | Description | Default | |------------------------------|------------------------------------------------------------------|-----------| | `imagePullSecrets` | Pull secrets applied to every pod, for private or mirrored registries | `[]` | +| `missionControl.enabled` | Deploy frontend/backend and their resources; disable MongoDB separately for an xGT-only release | `true` | | `fips.enabled` | Use FIPS images (`-fips` tags + Percona MongoDB); see FIPS Mode | `false` | | `fips.mongoImage.repository` | FIPS MongoDB image repository | `docker.io/percona/percona-server-mongodb` | | `fips.mongoImage.tag` | FIPS MongoDB image tag | `8.0.23` | -| `openshift.enabled` | Create ServiceAccount bound to the SCC set by `openshift.scc` | `false` | -| `openshift.scc` | SCC to grant: `anyuid` (fixed-UID images) or `nonroot` | `anyuid` | +| `openshift.enabled` | Create a ServiceAccount and configure the selected SCC profile | `false` | +| `openshift.scc` | `anyuid`, `nonroot`, or `restricted-v2` for XGT/Mission Control/MongoDB (no elevated binding) | `anyuid` | | `networkPolicy.enabled` | Restrict inter-component traffic with per-component policies | `true` | | `xgt.license.existingSecret` | Secret with key `xgtd.lic` (direct file mount) | `""` | | `xgt.license.data` | Inline license content (use `--set-file`) | `""` | diff --git a/charts/rocketgraph/examples/xgt_existing_files.yaml b/charts/rocketgraph/examples/xgt_existing_files.yaml new file mode 100644 index 0000000..1d97cde --- /dev/null +++ b/charts/rocketgraph/examples/xgt_existing_files.yaml @@ -0,0 +1,23 @@ +# Complete XGT-only values example. Do not layer over the managed-config example. +# Pre-populate PVC xgt-files with xgt-prod/{conf,license,data,log}/. +# Configuration, TLS/CA files and license are supplied on the PVC. +# To split out data/logs, set xgt.persistence.data/log.existingClaim. +missionControl: + enabled: false +mongodb: + enabled: false +openshift: + enabled: true + scc: restricted-v2 +fips: + enabled: true +xgt: + hostname: xgt-prod-0 + image: + tag: 2.7.1 + files: + existingClaim: xgt-files + subPath: xgt-prod + resources: + requests: {cpu: 500m, memory: 2Gi} + limits: {cpu: '2', memory: 4Gi} diff --git a/charts/rocketgraph/examples/xgt_files/audit.xml b/charts/rocketgraph/examples/xgt_files/audit.xml new file mode 100644 index 0000000..be799fd --- /dev/null +++ b/charts/rocketgraph/examples/xgt_files/audit.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/charts/rocketgraph/examples/xgt_files/grouplabel.csv b/charts/rocketgraph/examples/xgt_files/grouplabel.csv new file mode 100644 index 0000000..6982a5e --- /dev/null +++ b/charts/rocketgraph/examples/xgt_files/grouplabel.csv @@ -0,0 +1,4 @@ +group,label +xgtd,xgtadmin +xgt-admins,xgtadmin +xgt-users,data-users diff --git a/charts/rocketgraph/examples/xgt_files/label.csv b/charts/rocketgraph/examples/xgt_files/label.csv new file mode 100644 index 0000000..7ce1f32 --- /dev/null +++ b/charts/rocketgraph/examples/xgt_files/label.csv @@ -0,0 +1,3 @@ +label +xgtadmin +data-users diff --git a/charts/rocketgraph/examples/xgt_files/xgtd.conf b/charts/rocketgraph/examples/xgt_files/xgtd.conf new file mode 100644 index 0000000..a86fa02 --- /dev/null +++ b/charts/rocketgraph/examples/xgt_files/xgtd.conf @@ -0,0 +1,24 @@ +{ + "system.max_memory": "1", + "system.usessl": "true", + "system.usemtls": "false", + "system.ssl_root_dir": "/conf/ssl", + "license.location": "/license/xgtd.lic", + "logging.filepath": "/log", + "logging.fileprefix": "xgtd", + "logging.log_to_console": "true", + "audit.config_file": "/conf/audit.xml", + "security.adminlabel": "xgtadmin", + "security.grouplabelfile": "/conf/grouplabel.csv", + "security.labelfile": "/conf/label.csv", + "security.oidc": { + "issuer": "https://oauth-openshift.apps.example.com", + "client_id": "xgt-demo-client", + "validation_mode": "openshift_userapi", + "openshift_user_api_uri": "https://kubernetes.default.svc/apis/user.openshift.io/v1/users/~", + "username_claim": "metadata.name", + "groups_claim": "groups", + "scopes": "user:info", + "ca_cert": "/conf/oidc-ca.pem" + } +} diff --git a/charts/rocketgraph/examples/xgt_files_separate_data.yaml b/charts/rocketgraph/examples/xgt_files_separate_data.yaml new file mode 100644 index 0000000..e6a6c57 --- /dev/null +++ b/charts/rocketgraph/examples/xgt_files_separate_data.yaml @@ -0,0 +1,29 @@ +# Complete XGT-only example: configuration, license and logs on xgt-files; +# data on a separate existing PVC. Both claims must be in the release namespace. +# Pre-populate xgt-files with xgt-prod/{conf,license,log}/. +# The root of xgt-data mounts at /data; files.subPath does not apply to it. +missionControl: + enabled: false +mongodb: + enabled: false +openshift: + enabled: true + scc: restricted-v2 +fips: + enabled: true +xgt: + hostname: xgt-prod-0 + image: + tag: 2.7.1 + files: + existingClaim: xgt-files + subPath: xgt-prod + persistence: + data: + existingClaim: xgt-data + # To put logs on a separate PVC too, uncomment: + # log: + # existingClaim: xgt-logs + resources: + requests: {cpu: 500m, memory: 2Gi} + limits: {cpu: '2', memory: 4Gi} diff --git a/charts/rocketgraph/examples/xgt_openshift_restricted.yaml b/charts/rocketgraph/examples/xgt_openshift_restricted.yaml new file mode 100644 index 0000000..c1ff347 --- /dev/null +++ b/charts/rocketgraph/examples/xgt_openshift_restricted.yaml @@ -0,0 +1,48 @@ +# XGT only, with Helm-managed configuration and existing license/TLS/CA Secrets. +# Supply the referenced Secrets and edit issuer, client ID and group names. +missionControl: + enabled: false +mongodb: + enabled: false +openshift: + enabled: true + scc: restricted-v2 +fips: + enabled: true +xgt: + hostname: xgt-test-0 + image: + tag: 2.7.1 + license: + existingSecret: xgt-license + ssl: + enabled: true + existingSecret: xgt-ssl + config: + grouplabelCsv: | + group,label + xgtd,xgtadmin + xgt-admins,xgtadmin + xgt-users,data-users + labelCsv: | + label + xgtadmin + data-users + extraConfig: + system.max_memory: '1' + security.oidc: + issuer: https://oauth-openshift.apps.example.com + client_id: xgt-demo-client + validation_mode: openshift_userapi + openshift_user_api_uri: https://kubernetes.default.svc/apis/user.openshift.io/v1/users/~ + username_claim: metadata.name + groups_claim: groups + scopes: user:info + # The chart defaults ca_cert to the mounted OIDC CA when omitted. + resources: + requests: {cpu: 500m, memory: 2Gi} + limits: {cpu: '2', memory: 4Gi} +backend: + oidc: + # Shared CA mount is available even when Mission Control is disabled. + caCertExistingSecret: oidc-ca diff --git a/charts/rocketgraph/templates/NOTES.txt b/charts/rocketgraph/templates/NOTES.txt index 260d595..c49f2a5 100644 --- a/charts/rocketgraph/templates/NOTES.txt +++ b/charts/rocketgraph/templates/NOTES.txt @@ -1,6 +1,7 @@ {{- include "rocketgraph.validate" . }} Rocketgraph has been deployed! +{{ if .Values.missionControl.enabled }} To access the frontend: kubectl port-forward svc/{{ include "rocketgraph.fullname.frontend" . }} 8080:{{ .Values.frontend.service.httpPort }} @@ -20,13 +21,25 @@ OpenShift Route: NOTE: Using external xGT at {{ .Values.backend.env.MC_DEFAULT_XGT_HOST }}{{ with .Values.backend.env.MC_DEFAULT_XGT_PORT }}:{{ . }}{{ end }} {{- end }} -{{- if not .Values.mongodb.enabled }} +{{- end }} + +{{- if and .Values.missionControl.enabled (not .Values.mongodb.enabled) }} NOTE: Using external MongoDB. -{{- else if .Values.mongodb.auth.enabled }} +{{- else if and .Values.mongodb.enabled .Values.mongodb.auth.enabled }} MongoDB auth: ENABLED (root user "rocketgraph"). -{{- else }} +{{- else if .Values.mongodb.enabled }} WARNING: MongoDB auth is DISABLED. Set mongodb.auth.enabled=true (with mongodb.auth.rootPassword or an existingSecret) for production use. {{- end }} +{{- if and (not .Values.missionControl.enabled) .Values.mongodb.enabled }} +WARNING: Mission Control is disabled but MongoDB is still enabled. Set mongodb.enabled=false for an XGT-only release. +{{- end }} + +{{ if .Values.xgt.enabled }} +xGT Service: {{ include "rocketgraph.fullname.xgt" . }}:{{ .Values.xgt.port }} +{{- with .Values.xgt.hostname }} +xGT container hostname: {{ . }} (the pod name is generated by the Deployment). +{{- end }} +{{- end }} diff --git a/charts/rocketgraph/templates/_helpers.tpl b/charts/rocketgraph/templates/_helpers.tpl index 37a8bb8..f56aa87 100644 --- a/charts/rocketgraph/templates/_helpers.tpl +++ b/charts/rocketgraph/templates/_helpers.tpl @@ -128,6 +128,34 @@ FIPS image tag suffix — appends "-fips" when fips.enabled=true, empty otherwis {{- if .Values.fips.enabled }}-fips{{- end -}} {{- end -}} +{{/* Security contexts for the namespace-assigned OpenShift UID/GID profile. */}} +{{- define "rocketgraph.podSecurityContext" -}} +{{- $context := deepCopy (.context | default dict) -}} +{{- if and .root.Values.openshift.enabled (eq .root.Values.openshift.scc "restricted-v2") -}} +{{- $_ := set $context "seccompProfile" (dict "type" "RuntimeDefault") -}} +{{- end -}} +{{- toYaml $context -}} +{{- end -}} + +{{- define "rocketgraph.containerSecurityContext" -}} +{{- $context := deepCopy (.context | default dict) -}} +{{- if and .root.Values.openshift.enabled (eq .root.Values.openshift.scc "restricted-v2") -}} +{{- $_ := set $context "runAsNonRoot" true -}} +{{- $_ := set $context "allowPrivilegeEscalation" false -}} +{{- $_ := set $context "capabilities" (dict "drop" (list "ALL")) -}} +{{- $_ := set $context "seccompProfile" (dict "type" "RuntimeDefault") -}} +{{- end -}} +{{- toYaml $context -}} +{{- end -}} + +{{- define "rocketgraph.frontendHttpPort" -}} +{{- if and .Values.openshift.enabled (eq .Values.openshift.scc "restricted-v2") -}}8080{{- else -}}80{{- end -}} +{{- end -}} + +{{- define "rocketgraph.frontendHttpsPort" -}} +{{- if and .Values.openshift.enabled (eq .Values.openshift.scc "restricted-v2") -}}8443{{- else -}}443{{- end -}} +{{- end -}} + {{/* MongoDB image — switches to the FIPS image (Percona) when fips.enabled=true. */}} diff --git a/charts/rocketgraph/templates/_validation.tpl b/charts/rocketgraph/templates/_validation.tpl index e899921..8cc9cde 100644 --- a/charts/rocketgraph/templates/_validation.tpl +++ b/charts/rocketgraph/templates/_validation.tpl @@ -4,6 +4,74 @@ Call via: {{- include "rocketgraph.validate" . }} */}} {{- define "rocketgraph.validate" -}} +{{- if and .Values.openshift.enabled (eq .Values.openshift.scc "restricted-v2") }} + {{- if and .Values.missionControl.enabled (not .Values.fips.enabled) }} + {{- fail "restricted-v2 with Mission Control requires fips.enabled=true; the non-FIPS frontend image has different startup and writable paths" }} + {{- end }} + {{- if .Values.xgt.licenseManager.enabled }} + {{- fail "restricted-v2 does not support the bundled License Manager; use an external license server or a license file" }} + {{- end }} + {{- if and .Values.xgt.enabled .Values.xgt.ldap.enabled }} + {{- fail "restricted-v2 direct startup does not run in-container SSSD; use OpenShift OAuth or Keycloak authentication" }} + {{- end }} + {{- range $name := list "frontend" "backend" "mongodb" "xgt" }} + {{- $component := index $.Values $name }} + {{- $active := ternary $.Values.missionControl.enabled $component.enabled (has $name (list "frontend" "backend")) }} + {{- if $active }} + {{- range $context := list $component.podSecurityContext $component.containerSecurityContext }} + {{- range $field := list "runAsUser" "runAsGroup" "fsGroup" "supplementalGroups" }} + {{- if and (hasKey $context $field) (ne (index $context $field) nil) }} + {{- fail (printf "restricted-v2 assigns the namespace UID/group: remove %s security context %s" $name $field) }} + {{- end }} + {{- end }} + {{- if $context.privileged }}{{- fail (printf "restricted-v2 does not permit privileged %s containers" $name) }}{{- end }} + {{- if dig "capabilities" "add" (list) $context }}{{- fail (printf "restricted-v2 profile does not add capabilities for %s" $name) }}{{- end }} + {{- end }} + {{- end }} + {{- end }} + {{- if and .Values.xgt.enabled (not .Values.xgt.files.existingClaim) (not .Values.xgt.config.existingConfigMap) (not .Values.xgt.license.existingSecret) (not .Values.xgt.license.data) (not (index .Values.xgt.extraConfig "license.location")) }} + {{- fail "restricted-v2 needs a readable license: set xgt.license.existingSecret (or data), xgt.files.existingClaim, or xgt.extraConfig.license.location. The bundled image license is not readable by an arbitrary UID." }} + {{- end }} +{{- end }} + +{{- if .Values.xgt.enabled }} +{{- if .Values.xgt.files.existingClaim }} + {{- if or .Values.xgt.config.existingConfigMap .Values.xgt.config.grouplabelCsv .Values.xgt.config.labelCsv .Values.xgt.config.proxyList .Values.xgt.extraConfig }} + {{- fail "xgt.files.existingClaim uses configuration files on the PVC; remove xgt.config overrides and xgt.extraConfig and edit the PVC files instead" }} + {{- end }} + {{- if or .Values.xgt.license.existingSecret .Values.xgt.license.data .Values.xgt.licenseManager.enabled .Values.xgt.ldap.enabled .Values.xgt.ssl.existingSecret .Values.xgt.ssl.cert .Values.xgt.ssl.key .Values.xgt.ssl.caCert }} + {{- fail "xgt.files.existingClaim supplies license and TLS files on the PVC; remove separate license/TLS/LDAP sources and the bundled license manager" }} + {{- end }} +{{- end }} +{{- if and .Values.xgt.config.existingConfigMap (or .Values.xgt.config.grouplabelCsv .Values.xgt.config.labelCsv .Values.xgt.config.proxyList .Values.xgt.extraConfig) }} + {{- fail "xgt.config.existingConfigMap supplies complete configuration; remove inline xgt.config overrides and xgt.extraConfig" }} +{{- end }} +{{- if and .Values.xgt.files.subPath (not .Values.xgt.files.existingClaim) }} + {{- fail "xgt.files.subPath requires xgt.files.existingClaim" }} +{{- end }} +{{- $volumeNames := list "xgt-config" "xgt-data" "xgt-log" "xgt-tls" "xgt-license" "sssd-config" "oidc-ca-cert" "xgt-files" }} +{{- range .Values.xgt.extraVolumes }} + {{- if or (not .name) (has .name $volumeNames) }}{{- fail "xgt.extraVolumes names must be unique and must not replace chart volume names" }}{{- end }} + {{- $volumeNames = append $volumeNames .name }} +{{- end }} +{{- $mountPaths := list "/data" "/log" "/etc/ssl/certs/oidc-ca.pem" }} +{{- if .Values.xgt.files.existingClaim }} + {{- $mountPaths = concat $mountPaths (list "/conf" "/license") }} +{{- else }} + {{- $mountPaths = concat $mountPaths (list "/conf/xgtd.conf" "/conf/audit.xml" "/conf/grouplabel.csv" "/conf/label.csv") }} + {{- if .Values.xgt.ssl.enabled }}{{- $mountPaths = append $mountPaths "/conf/ssl" }}{{- end }} + {{- if or .Values.xgt.license.existingSecret .Values.xgt.license.data }}{{- $mountPaths = append $mountPaths "/license/xgtd.lic" }}{{- end }} + {{- if .Values.xgt.ldap.enabled }}{{- $mountPaths = append $mountPaths "/etc/sssd-config" }}{{- end }} + {{- if .Values.xgt.config.proxyList }}{{- $mountPaths = append $mountPaths "/conf/proxy_list" }}{{- end }} +{{- end }} +{{- range .Values.xgt.extraVolumeMounts }} + {{- if or (not .mountPath) (has .mountPath $mountPaths) }}{{- fail "xgt.extraVolumeMounts must use unique mount paths and must not replace chart mounts" }}{{- end }} + {{- $mountPaths = append $mountPaths .mountPath }} +{{- end }} +{{- end }} + + +{{- if .Values.missionControl.enabled }} {{- if and .Values.frontend.tls.publicCert (not .Values.frontend.tls.privateKey) }} {{- fail "frontend.tls.publicCert is set but frontend.tls.privateKey is missing" }} {{- end }} @@ -21,14 +89,16 @@ Call via: {{- include "rocketgraph.validate" . }} {{- fail "backend.tls.mtls is true but no existingSecret or inline proxyClientCert/proxyClientKey provided" }} {{- end }} -{{- if and .Values.xgt.enabled .Values.xgt.ssl.enabled .Values.xgt.ssl.mtls (not .Values.xgt.ssl.existingSecret) (not .Values.xgt.ssl.caCert) }} +{{- end }} + +{{- if and .Values.xgt.enabled (not .Values.xgt.files.existingClaim) .Values.xgt.ssl.enabled .Values.xgt.ssl.mtls (not .Values.xgt.ssl.existingSecret) (not .Values.xgt.ssl.caCert) }} {{- fail "xgt.ssl.mtls is true but no existingSecret or inline caCert provided for ca-chain.cert.pem" }} {{- end }} -{{- if and .Values.xgt.enabled .Values.xgt.ssl.enabled .Values.xgt.ssl.mtls .Values.xgt.ssl.existingSecret .Values.xgt.ssl.caCert }} +{{- if and .Values.xgt.enabled (not .Values.xgt.files.existingClaim) .Values.xgt.ssl.enabled .Values.xgt.ssl.mtls .Values.xgt.ssl.existingSecret .Values.xgt.ssl.caCert }} {{- fail "xgt.ssl.caCert is ignored when existingSecret is set — include ca-chain.cert.pem in the existing secret instead" }} {{- end }} -{{- if and .Values.xgt.enabled .Values.xgt.ssl.enabled (not .Values.xgt.ssl.existingSecret) }} +{{- if and .Values.xgt.enabled (not .Values.xgt.files.existingClaim) .Values.xgt.ssl.enabled (not .Values.xgt.ssl.existingSecret) }} {{- if and .Values.xgt.ssl.cert (not .Values.xgt.ssl.key) }} {{- fail "xgt.ssl.cert is set but xgt.ssl.key is missing" }} {{- end }} @@ -40,7 +110,7 @@ Call via: {{- include "rocketgraph.validate" . }} {{- end }} {{- end }} -{{- if and .Values.xgt.enabled .Values.xgt.ldap.enabled (not .Values.xgt.ldap.existingSecret) (not .Values.xgt.ldap.sssdConfig) }} +{{- if and .Values.xgt.enabled (not .Values.xgt.files.existingClaim) .Values.xgt.ldap.enabled (not .Values.xgt.ldap.existingSecret) (not .Values.xgt.ldap.sssdConfig) }} {{- if not .Values.xgt.ldap.uri }} {{- fail "xgt.ldap.enabled is true but xgt.ldap.uri is not set" }} {{- end }} @@ -49,8 +119,8 @@ Call via: {{- include "rocketgraph.validate" . }} {{- end }} {{- end }} -{{- if and .Values.openshift.enabled (not (has .Values.openshift.scc (list "anyuid" "nonroot"))) }} - {{- fail (printf "openshift.scc %q is not valid — must be \"anyuid\" or \"nonroot\"" .Values.openshift.scc) }} +{{- if and .Values.openshift.enabled (not (has .Values.openshift.scc (list "anyuid" "nonroot" "restricted-v2"))) }} + {{- fail (printf "openshift.scc %q is not valid — must be \"anyuid\", \"nonroot\" or \"restricted-v2\"" .Values.openshift.scc) }} {{- end }} {{- if and .Values.mongodb.enabled (gt (.Values.mongodb.replicas | int) 1) }} @@ -61,11 +131,11 @@ Call via: {{- include "rocketgraph.validate" . }} {{- fail "xgt.replicas > 1 is not supported — multiple xgt instances would have no shared state in this configuration." }} {{- end }} -{{- if and (not .Values.xgt.enabled) (not .Values.backend.env.MC_DEFAULT_XGT_HOST) }} +{{- if and .Values.missionControl.enabled (not .Values.xgt.enabled) (not .Values.backend.env.MC_DEFAULT_XGT_HOST) }} {{- fail "xgt.enabled is false but backend.env.MC_DEFAULT_XGT_HOST is not set" }} {{- end }} -{{- if and (not .Values.mongodb.enabled) (not .Values.mongodb.externalUri) (not .Values.mongodb.externalUriSecret) }} +{{- if and .Values.missionControl.enabled (not .Values.mongodb.enabled) (not .Values.mongodb.externalUri) (not .Values.mongodb.externalUriSecret) }} {{- fail "mongodb.enabled is false but neither mongodb.externalUri nor mongodb.externalUriSecret is set" }} {{- end }} @@ -110,12 +180,13 @@ Call via: {{- include "rocketgraph.validate" . }} {{- end }} {{- end }} -{{- if gt (.Values.backend.replicas | int) 1 }} +{{- if and .Values.missionControl.enabled (gt (.Values.backend.replicas | int) 1) }} {{- fail "backend.replicas > 1 is not supported — session state is not shared across instances." }} {{- end }} {{- range $name := list "frontend" "backend" "xgt" "mongodb" }} - {{- if hasKey $.Values $name }} + {{- $active := ternary $.Values.missionControl.enabled ((index $.Values $name).enabled) (has $name (list "frontend" "backend")) }} + {{- if and $active (hasKey $.Values $name) }} {{- $component := index $.Values $name }} {{- if hasKey $component "podDisruptionBudget" }} {{- $pdb := $component.podDisruptionBudget }} diff --git a/charts/rocketgraph/templates/backend-deployment.yaml b/charts/rocketgraph/templates/backend-deployment.yaml index 732b539..d08a97c 100644 --- a/charts/rocketgraph/templates/backend-deployment.yaml +++ b/charts/rocketgraph/templates/backend-deployment.yaml @@ -1,3 +1,4 @@ +{{- if .Values.missionControl.enabled }} apiVersion: apps/v1 kind: Deployment metadata: @@ -39,7 +40,7 @@ spec: {{- if .Values.openshift.enabled }} serviceAccountName: {{ include "rocketgraph.fullname.serviceaccount" . }} {{- end }} - {{- with .Values.backend.podSecurityContext }} + {{- with (include "rocketgraph.podSecurityContext" (dict "root" . "context" .Values.backend.podSecurityContext) | fromYaml) }} securityContext: {{- toYaml . | nindent 8 }} {{- end }} @@ -47,7 +48,7 @@ spec: - name: backend image: "{{ .Values.backend.image.repository }}:{{ coalesce .Values.backend.image.tag .Chart.AppVersion }}{{ include "rocketgraph.fipsSuffix" . }}" imagePullPolicy: {{ .Values.backend.image.pullPolicy }} - {{- with .Values.backend.containerSecurityContext }} + {{- with (include "rocketgraph.containerSecurityContext" (dict "root" . "context" .Values.backend.containerSecurityContext) | fromYaml) }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} @@ -298,3 +299,5 @@ spec: secretName: {{ include "rocketgraph.mongodbTlsSecret" . }} {{- end }} {{- end }} + +{{- end }} diff --git a/charts/rocketgraph/templates/backend-oidc-secret.yaml b/charts/rocketgraph/templates/backend-oidc-secret.yaml index 9a30a8e..a2fd601 100644 --- a/charts/rocketgraph/templates/backend-oidc-secret.yaml +++ b/charts/rocketgraph/templates/backend-oidc-secret.yaml @@ -1,4 +1,4 @@ -{{- if and (not .Values.backend.oidc.existingSecret) .Values.backend.oidc.clientSecret -}} +{{- if and .Values.missionControl.enabled (not .Values.backend.oidc.existingSecret) .Values.backend.oidc.clientSecret -}} apiVersion: v1 kind: Secret metadata: @@ -10,7 +10,7 @@ type: Opaque stringData: MC_OIDC_CLIENT_SECRET: {{ .Values.backend.oidc.clientSecret | quote }} {{- end }} -{{- if and (not .Values.backend.oidc.caCertExistingSecret) .Values.backend.oidc.caCert }} +{{- if and (or .Values.missionControl.enabled .Values.xgt.enabled) (not .Values.backend.oidc.caCertExistingSecret) .Values.backend.oidc.caCert }} --- apiVersion: v1 kind: Secret diff --git a/charts/rocketgraph/templates/backend-pdb.yaml b/charts/rocketgraph/templates/backend-pdb.yaml index 07627f2..49f90d4 100644 --- a/charts/rocketgraph/templates/backend-pdb.yaml +++ b/charts/rocketgraph/templates/backend-pdb.yaml @@ -1 +1,4 @@ +{{- if .Values.missionControl.enabled }} {{- include "rocketgraph.pdb" (list "backend" .) -}} + +{{- end }} diff --git a/charts/rocketgraph/templates/backend-pvc.yaml b/charts/rocketgraph/templates/backend-pvc.yaml index 95852fd..a469299 100644 --- a/charts/rocketgraph/templates/backend-pvc.yaml +++ b/charts/rocketgraph/templates/backend-pvc.yaml @@ -1,3 +1,4 @@ +{{- if .Values.missionControl.enabled }} {{- if and .Values.backend.odbc.enabled (not .Values.backend.odbc.existingClaim) }} apiVersion: v1 kind: PersistentVolumeClaim @@ -35,3 +36,5 @@ spec: storageClassName: {{ .Values.backend.iaccess.storageClassName | quote }} {{- end }} {{- end }} + +{{- end }} diff --git a/charts/rocketgraph/templates/backend-service.yaml b/charts/rocketgraph/templates/backend-service.yaml index cbe5b6f..e43fbe7 100644 --- a/charts/rocketgraph/templates/backend-service.yaml +++ b/charts/rocketgraph/templates/backend-service.yaml @@ -1,3 +1,4 @@ +{{- if .Values.missionControl.enabled }} apiVersion: v1 kind: Service metadata: @@ -19,3 +20,5 @@ spec: selector: app: backend app.kubernetes.io/instance: {{ .Release.Name }} + +{{- end }} diff --git a/charts/rocketgraph/templates/backend-site-configmap.yaml b/charts/rocketgraph/templates/backend-site-configmap.yaml index f290db4..cdaa3a2 100644 --- a/charts/rocketgraph/templates/backend-site-configmap.yaml +++ b/charts/rocketgraph/templates/backend-site-configmap.yaml @@ -1,3 +1,4 @@ +{{- if .Values.missionControl.enabled }} {{- if or .Values.backend.siteConfig.yml .Values.backend.siteConfig.py }} apiVersion: v1 kind: ConfigMap @@ -16,3 +17,5 @@ data: {{ .Values.backend.siteConfig.py | indent 4 }} {{- end }} {{- end }} + +{{- end }} diff --git a/charts/rocketgraph/templates/backend-tls-secret.yaml b/charts/rocketgraph/templates/backend-tls-secret.yaml index 954c80c..df0f69c 100644 --- a/charts/rocketgraph/templates/backend-tls-secret.yaml +++ b/charts/rocketgraph/templates/backend-tls-secret.yaml @@ -1,3 +1,4 @@ +{{- if .Values.missionControl.enabled }} {{- if and (not .Values.backend.tls.existingSecret) (or .Values.backend.tls.xgtServerCert .Values.backend.tls.proxyClientCert .Values.backend.tls.proxyClientKey) }} apiVersion: v1 kind: Secret @@ -18,3 +19,5 @@ stringData: proxy-client-key.pem: {{ .Values.backend.tls.proxyClientKey | quote }} {{- end }} {{- end }} + +{{- end }} diff --git a/charts/rocketgraph/templates/frontend-deployment.yaml b/charts/rocketgraph/templates/frontend-deployment.yaml index e81edeb..453ae32 100644 --- a/charts/rocketgraph/templates/frontend-deployment.yaml +++ b/charts/rocketgraph/templates/frontend-deployment.yaml @@ -1,3 +1,6 @@ +{{- if .Values.missionControl.enabled }} +{{- $restricted := and .Values.openshift.enabled (eq .Values.openshift.scc "restricted-v2") }} +{{- $tls := or .Values.frontend.tls.existingSecret .Values.frontend.tls.publicCert .Values.frontend.tls.privateKey }} apiVersion: apps/v1 kind: Deployment metadata: @@ -28,7 +31,7 @@ spec: {{- if .Values.openshift.enabled }} serviceAccountName: {{ include "rocketgraph.fullname.serviceaccount" . }} {{- end }} - {{- with .Values.frontend.podSecurityContext }} + {{- with (include "rocketgraph.podSecurityContext" (dict "root" . "context" .Values.frontend.podSecurityContext) | fromYaml) }} securityContext: {{- toYaml . | nindent 8 }} {{- end }} @@ -36,21 +39,46 @@ spec: - name: frontend image: "{{ .Values.frontend.image.repository }}:{{ coalesce .Values.frontend.image.tag .Chart.AppVersion }}{{ include "rocketgraph.fipsSuffix" . }}" imagePullPolicy: {{ .Values.frontend.image.pullPolicy }} - {{- with .Values.frontend.containerSecurityContext }} + {{- with (include "rocketgraph.containerSecurityContext" (dict "root" . "context" .Values.frontend.containerSecurityContext) | fromYaml) }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} + {{- if $restricted }} + command: ["/bin/sh", "-ec"] + args: + - | + /usr/local/bin/docker-entrypoint-ssl.sh + # Newer images share proxy headers in a read-only image file. + # Keep the adjusted copy in the writable config volume; .inc + # prevents nginx's conf.d/*.conf glob from loading it globally. + set -- /etc/nginx/conf.d/nginx.conf + if [ -f /etc/nginx/api_proxy_headers.inc ]; then + cp /etc/nginx/api_proxy_headers.inc /etc/nginx/conf.d/api_proxy_headers.inc + sed -i 's|/etc/nginx/api_proxy_headers.inc|/etc/nginx/conf.d/api_proxy_headers.inc|g' /etc/nginx/conf.d/nginx.conf + set -- "$@" /etc/nginx/conf.d/api_proxy_headers.inc + fi + sed -i -E \ + -e 's/(listen[[:space:]]+(\[::\]:)?)80([[:space:];])/\18080\3/g' \ + -e 's/(listen[[:space:]]+(\[::\]:)?)443([[:space:];])/\18443\3/g' \ + -e 's/proxy_set_header X-Forwarded-Port \$server_port;/proxy_set_header X-Forwarded-Port {{ ternary .Values.frontend.service.httpsPort .Values.frontend.service.httpPort (not (empty $tls)) }};/' \ + "$@" + exec nginx -g 'daemon off;' + {{- end }} env: - name: BACKEND_HOST value: {{ include "rocketgraph.fullname.backend" . | quote }} - name: BACKEND_PORT value: "5000" + {{- if $restricted }} + - name: MC_SSL_PORT + value: {{ .Values.backend.env.MC_SSL_PORT | default (.Values.frontend.service.httpsPort | toString) | quote }} + {{- end }} ports: - name: http - containerPort: 80 + containerPort: {{ include "rocketgraph.frontendHttpPort" . }} protocol: TCP - name: https - containerPort: 443 + containerPort: {{ include "rocketgraph.frontendHttpsPort" . }} protocol: TCP readinessProbe: httpGet: @@ -71,8 +99,15 @@ spec: resources: {{- toYaml . | nindent 12 }} {{- end }} - {{- if or .Values.frontend.tls.existingSecret .Values.frontend.tls.publicCert .Values.frontend.tls.privateKey }} + {{- if or $restricted $tls }} volumeMounts: + {{- if $restricted }} + {{- range $mount := list (dict "name" "nginx-config" "path" "/etc/nginx/conf.d") (dict "name" "nginx-run" "path" "/run") (dict "name" "nginx-log" "path" "/var/log/nginx") (dict "name" "nginx-temp" "path" "/var/lib/nginx/tmp") }} + - name: {{ $mount.name }} + mountPath: {{ $mount.path }} + {{- end }} + {{- end }} + {{- if $tls }} - name: tls-certs mountPath: /etc/ssl/certs/td.pem subPath: public.pem @@ -88,6 +123,7 @@ spec: readOnly: true {{- end }} {{- end }} + {{- end }} {{- with .Values.frontend.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -101,9 +137,19 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} restartPolicy: Always - {{- if or .Values.frontend.tls.existingSecret .Values.frontend.tls.publicCert .Values.frontend.tls.privateKey }} + {{- if or $restricted $tls }} volumes: + {{- if $restricted }} + {{- range $name := list "nginx-config" "nginx-run" "nginx-log" "nginx-temp" }} + - name: {{ $name }} + emptyDir: {} + {{- end }} + {{- end }} + {{- if $tls }} - name: tls-certs secret: secretName: {{ include "rocketgraph.frontendTlsSecret" . }} {{- end }} + {{- end }} + +{{- end }} diff --git a/charts/rocketgraph/templates/frontend-pdb.yaml b/charts/rocketgraph/templates/frontend-pdb.yaml index 3e2cd05..5c0c9d6 100644 --- a/charts/rocketgraph/templates/frontend-pdb.yaml +++ b/charts/rocketgraph/templates/frontend-pdb.yaml @@ -1 +1,4 @@ +{{- if .Values.missionControl.enabled }} {{- include "rocketgraph.pdb" (list "frontend" .) -}} + +{{- end }} diff --git a/charts/rocketgraph/templates/frontend-service.yaml b/charts/rocketgraph/templates/frontend-service.yaml index 0fc37b5..63e3eca 100644 --- a/charts/rocketgraph/templates/frontend-service.yaml +++ b/charts/rocketgraph/templates/frontend-service.yaml @@ -1,3 +1,4 @@ +{{- if .Values.missionControl.enabled }} apiVersion: v1 kind: Service metadata: @@ -14,10 +15,12 @@ spec: ports: - name: http port: {{ .Values.frontend.service.httpPort }} - targetPort: 80 + targetPort: {{ include "rocketgraph.frontendHttpPort" . }} - name: https port: {{ .Values.frontend.service.httpsPort }} - targetPort: 443 + targetPort: {{ include "rocketgraph.frontendHttpsPort" . }} selector: app: frontend app.kubernetes.io/instance: {{ .Release.Name }} + +{{- end }} diff --git a/charts/rocketgraph/templates/frontend-tls-secret.yaml b/charts/rocketgraph/templates/frontend-tls-secret.yaml index cb37947..3945383 100644 --- a/charts/rocketgraph/templates/frontend-tls-secret.yaml +++ b/charts/rocketgraph/templates/frontend-tls-secret.yaml @@ -1,3 +1,4 @@ +{{- if .Values.missionControl.enabled }} {{- if and (not .Values.frontend.tls.existingSecret) (or .Values.frontend.tls.publicCert .Values.frontend.tls.privateKey .Values.frontend.tls.certChain) }} apiVersion: v1 kind: Secret @@ -18,3 +19,5 @@ stringData: chain.pem: {{ .Values.frontend.tls.certChain | quote }} {{- end }} {{- end }} + +{{- end }} diff --git a/charts/rocketgraph/templates/ingress.yaml b/charts/rocketgraph/templates/ingress.yaml index 7185c83..6a1a1f7 100644 --- a/charts/rocketgraph/templates/ingress.yaml +++ b/charts/rocketgraph/templates/ingress.yaml @@ -1,4 +1,4 @@ -{{- if .Values.ingress.enabled }} +{{- if and .Values.missionControl.enabled .Values.ingress.enabled }} apiVersion: networking.k8s.io/v1 kind: Ingress metadata: diff --git a/charts/rocketgraph/templates/mongodb-deployment.yaml b/charts/rocketgraph/templates/mongodb-deployment.yaml index 771c424..181d5d6 100644 --- a/charts/rocketgraph/templates/mongodb-deployment.yaml +++ b/charts/rocketgraph/templates/mongodb-deployment.yaml @@ -1,4 +1,5 @@ {{- if .Values.mongodb.enabled }} +{{- $restricted := and .Values.openshift.enabled (eq .Values.openshift.scc "restricted-v2") }} apiVersion: apps/v1 kind: Deployment metadata: @@ -31,8 +32,8 @@ spec: {{- if .Values.openshift.enabled }} serviceAccountName: {{ include "rocketgraph.fullname.serviceaccount" . }} {{- end }} - {{- $podSecCtx := .Values.mongodb.podSecurityContext }} - {{- if and .Values.mongodb.encryption.enabled (not (hasKey (.Values.mongodb.podSecurityContext | default dict) "fsGroup")) }} + {{- $podSecCtx := include "rocketgraph.podSecurityContext" (dict "root" . "context" .Values.mongodb.podSecurityContext) | fromYaml }} + {{- if and (not $restricted) .Values.mongodb.encryption.enabled (not (hasKey (.Values.mongodb.podSecurityContext | default dict) "fsGroup")) }} {{- $podSecCtx = merge (dict "fsGroup" 1001) ($podSecCtx | default dict) }} {{- end }} {{- with $podSecCtx }} @@ -45,7 +46,13 @@ spec: image: "{{ include "rocketgraph.mongoImage" . }}" imagePullPolicy: {{ .Values.mongodb.image.pullPolicy }} securityContext: + {{- if $restricted }} + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + {{- else }} runAsUser: {{ dig "runAsUser" 1001 (.Values.mongodb.containerSecurityContext | default dict) }} + {{- end }} allowPrivilegeEscalation: false capabilities: drop: [ALL] @@ -87,7 +94,7 @@ spec: - /etc/mongodb-encryption/encryption.key {{- end }} {{- end }} - {{- with .Values.mongodb.containerSecurityContext }} + {{- with (include "rocketgraph.containerSecurityContext" (dict "root" . "context" .Values.mongodb.containerSecurityContext) | fromYaml) }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} diff --git a/charts/rocketgraph/templates/networkpolicy.yaml b/charts/rocketgraph/templates/networkpolicy.yaml index 75ed774..83384eb 100644 --- a/charts/rocketgraph/templates/networkpolicy.yaml +++ b/charts/rocketgraph/templates/networkpolicy.yaml @@ -1,4 +1,5 @@ {{- if .Values.networkPolicy.enabled }} +{{- if .Values.missionControl.enabled }} --- apiVersion: networking.k8s.io/v1 kind: NetworkPolicy @@ -15,9 +16,9 @@ spec: - Ingress ingress: - ports: - - port: 80 + - port: {{ include "rocketgraph.frontendHttpPort" . }} protocol: TCP - - port: 443 + - port: {{ include "rocketgraph.frontendHttpsPort" . }} protocol: TCP --- apiVersion: networking.k8s.io/v1 @@ -42,6 +43,7 @@ spec: ports: - port: 5000 protocol: TCP +{{- end }} {{- if .Values.xgt.enabled }} --- apiVersion: networking.k8s.io/v1 diff --git a/charts/rocketgraph/templates/scc.yaml b/charts/rocketgraph/templates/scc.yaml index e9723ee..3a9ee79 100644 --- a/charts/rocketgraph/templates/scc.yaml +++ b/charts/rocketgraph/templates/scc.yaml @@ -1,4 +1,4 @@ -{{- if .Values.openshift.enabled }} +{{- if and .Values.openshift.enabled (ne .Values.openshift.scc "restricted-v2") }} apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: diff --git a/charts/rocketgraph/templates/xgt-configmap.yaml b/charts/rocketgraph/templates/xgt-configmap.yaml index b21f62f..e93ae1c 100644 --- a/charts/rocketgraph/templates/xgt-configmap.yaml +++ b/charts/rocketgraph/templates/xgt-configmap.yaml @@ -1,4 +1,4 @@ -{{- if .Values.xgt.enabled }} +{{- if and .Values.xgt.enabled (not .Values.xgt.files.existingClaim) (not .Values.xgt.config.existingConfigMap) }} apiVersion: v1 kind: ConfigMap metadata: @@ -57,6 +57,12 @@ data: {{- $proxyStr := printf "[%s]" ($proxyItems | join ",") }} {{- $_ := set $defaults "security.proxy_list" $proxyStr }} {{- end }} - {{- $merged := merge (.Values.xgt.extraConfig | default dict) $defaults }} + {{- $merged := merge (deepCopy (.Values.xgt.extraConfig | default dict)) $defaults }} + {{- if and (index $merged "security.oidc") (or .Values.backend.oidc.caCert .Values.backend.oidc.caCertExistingSecret) }} + {{- $oidc := index $merged "security.oidc" }} + {{- if not (hasKey $oidc "ca_cert") }} + {{- $_ := set $oidc "ca_cert" "/etc/ssl/certs/oidc-ca.pem" }} + {{- end }} + {{- end }} {{- $merged | toPrettyJson | nindent 4 }} {{- end }} diff --git a/charts/rocketgraph/templates/xgt-deployment.yaml b/charts/rocketgraph/templates/xgt-deployment.yaml index 1bec05e..fb11c70 100644 --- a/charts/rocketgraph/templates/xgt-deployment.yaml +++ b/charts/rocketgraph/templates/xgt-deployment.yaml @@ -1,4 +1,7 @@ {{- if .Values.xgt.enabled }} +{{- $restricted := and .Values.openshift.enabled (eq .Values.openshift.scc "restricted-v2") }} +{{- $files := .Values.xgt.files.existingClaim }} +{{- $direct := or $restricted $files }} apiVersion: apps/v1 kind: Deployment metadata: @@ -20,7 +23,9 @@ spec: app: xgt app.kubernetes.io/instance: {{ .Release.Name }} annotations: + {{- if not (or $files .Values.xgt.config.existingConfigMap) }} checksum/config: {{ include (print $.Template.BasePath "/xgt-configmap.yaml") . | sha256sum }} + {{- end }} {{- if or .Values.backend.oidc.caCert .Values.backend.oidc.caCertExistingSecret }} checksum/oidc-ca-secret: {{ .Values.backend.oidc.caCert | default .Values.backend.oidc.caCertExistingSecret | sha256sum }} {{- end }} @@ -28,6 +33,9 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} spec: + {{- with .Values.xgt.hostname }} + hostname: {{ . | quote }} + {{- end }} {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} @@ -35,7 +43,7 @@ spec: {{- if .Values.openshift.enabled }} serviceAccountName: {{ include "rocketgraph.fullname.serviceaccount" . }} {{- end }} - {{- with .Values.xgt.podSecurityContext }} + {{- with (include "rocketgraph.podSecurityContext" (dict "root" . "context" .Values.xgt.podSecurityContext) | fromYaml) }} securityContext: {{- toYaml . | nindent 8 }} {{- end }} @@ -57,10 +65,35 @@ spec: - name: xgt image: "{{ .Values.xgt.image.repository }}:{{ coalesce .Values.xgt.image.tag .Chart.AppVersion }}{{ include "rocketgraph.fipsSuffix" . }}" imagePullPolicy: {{ .Values.xgt.image.pullPolicy }} - {{- with .Values.xgt.containerSecurityContext }} + {{- with (include "rocketgraph.containerSecurityContext" (dict "root" . "context" .Values.xgt.containerSecurityContext) | fromYaml) }} securityContext: {{- toYaml . | nindent 12 }} {{- end }} + {{- if .Values.xgt.command }} + command: {{ .Values.xgt.command | toJson }} + {{- with .Values.xgt.args }} + args: {{ . | toJson }} + {{- end }} + {{- else if $direct }} + command: ["/opt/xgtd/bin/xgtd"] + args: + - -c + - /conf/xgtd.conf + - -Dsystem.hostname=0.0.0.0 + - -Dsystem.io_directory=/data + - -Dsystem.io_follow_symbolic_links=true + - {{ printf "-Dsystem.port=%v" .Values.xgt.port | quote }} + - {{ printf "-Dsystem.health_port=%v" .Values.xgt.healthCheck.port | quote }} + {{- with .Values.xgt.args }} + {{- toYaml . | nindent 12 }} + {{- end }} + {{- else if .Values.xgt.args }} + args: {{ .Values.xgt.args | toJson }} + {{- end }} + {{- with .Values.xgt.env }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} ports: - name: xgt containerPort: {{ .Values.xgt.port }} @@ -88,6 +121,25 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} volumeMounts: + {{- if $files }} + {{- range $dir := list "conf" "license" "data" "log" }} + {{- $claim := "" }} + {{- if has $dir (list "data" "log") }} + {{- $claim = (index $.Values.xgt.persistence $dir).existingClaim }} + {{- end }} + {{- if $claim }} + - name: xgt-{{ $dir }} + mountPath: /{{ $dir }} + {{- else }} + - name: xgt-files + mountPath: /{{ $dir }} + subPath: {{ join "/" (compact (list $.Values.xgt.files.subPath $dir)) | quote }} + {{- if has $dir (list "conf" "license") }} + readOnly: true + {{- end }} + {{- end }} + {{- end }} + {{- else }} - name: xgt-config mountPath: /conf/xgtd.conf subPath: xgtd.conf @@ -125,12 +177,16 @@ spec: mountPath: /etc/sssd-config readOnly: true {{- end }} + {{- end }} {{- if or .Values.backend.oidc.caCert .Values.backend.oidc.caCertExistingSecret }} - name: oidc-ca-cert mountPath: /etc/ssl/certs/oidc-ca.pem subPath: oidc-ca.pem readOnly: true {{- end }} + {{- with .Values.xgt.extraVolumeMounts }} + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.xgt.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -145,9 +201,21 @@ spec: {{- end }} restartPolicy: Always volumes: + {{- if $files }} + - name: xgt-files + persistentVolumeClaim: + claimName: {{ $files | quote }} + {{- range $dir := list "data" "log" }} + {{- with (index $.Values.xgt.persistence $dir).existingClaim }} + - name: xgt-{{ $dir }} + persistentVolumeClaim: + claimName: {{ . | quote }} + {{- end }} + {{- end }} + {{- else }} - name: xgt-config configMap: - name: {{ include "rocketgraph.fullname.xgt" . }}-config + name: {{ .Values.xgt.config.existingConfigMap | default (printf "%s-config" (include "rocketgraph.fullname.xgt" .)) }} - name: xgt-data persistentVolumeClaim: claimName: {{ .Values.xgt.persistence.data.existingClaim | default (printf "%s-xgt-data" .Release.Name) }} @@ -163,7 +231,7 @@ spec: path: certs/server.cert.pem - key: server.key.pem path: private/server.key.pem - mode: 0400 + mode: {{ ternary "0440" "0400" $restricted }} {{- if and .Values.xgt.ssl.mtls (or .Values.xgt.ssl.caCert .Values.xgt.ssl.existingSecret) }} - key: ca-chain.cert.pem path: certs/ca-chain.cert.pem @@ -183,9 +251,13 @@ spec: path: sssd.conf mode: 0600 {{- end }} + {{- end }} {{- if or .Values.backend.oidc.caCert .Values.backend.oidc.caCertExistingSecret }} - name: oidc-ca-cert secret: secretName: {{ include "rocketgraph.backendOidcCaSecret" . }} {{- end }} + {{- with .Values.xgt.extraVolumes }} + {{- toYaml . | nindent 8 }} + {{- end }} {{- end }} diff --git a/charts/rocketgraph/templates/xgt-ldap-secret.yaml b/charts/rocketgraph/templates/xgt-ldap-secret.yaml index e066cd3..8256ee6 100644 --- a/charts/rocketgraph/templates/xgt-ldap-secret.yaml +++ b/charts/rocketgraph/templates/xgt-ldap-secret.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.xgt.enabled .Values.xgt.ldap.enabled (not .Values.xgt.ldap.existingSecret) }} +{{- if and .Values.xgt.enabled (not .Values.xgt.files.existingClaim) .Values.xgt.ldap.enabled (not .Values.xgt.ldap.existingSecret) }} apiVersion: v1 kind: Secret metadata: diff --git a/charts/rocketgraph/templates/xgt-license-secret.yaml b/charts/rocketgraph/templates/xgt-license-secret.yaml index ecada3c..2183967 100644 --- a/charts/rocketgraph/templates/xgt-license-secret.yaml +++ b/charts/rocketgraph/templates/xgt-license-secret.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.xgt.enabled (not .Values.xgt.license.existingSecret) .Values.xgt.license.data }} +{{- if and .Values.xgt.enabled (not .Values.xgt.files.existingClaim) (not .Values.xgt.license.existingSecret) .Values.xgt.license.data }} apiVersion: v1 kind: Secret metadata: diff --git a/charts/rocketgraph/templates/xgt-pvc.yaml b/charts/rocketgraph/templates/xgt-pvc.yaml index 26aaec2..efe6060 100644 --- a/charts/rocketgraph/templates/xgt-pvc.yaml +++ b/charts/rocketgraph/templates/xgt-pvc.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.xgt.enabled (not .Values.xgt.persistence.data.existingClaim) }} +{{- if and .Values.xgt.enabled (not .Values.xgt.files.existingClaim) (not .Values.xgt.persistence.data.existingClaim) }} --- apiVersion: v1 kind: PersistentVolumeClaim @@ -17,7 +17,7 @@ spec: storageClassName: {{ .Values.xgt.persistence.data.storageClassName | quote }} {{- end }} {{- end }} -{{- if and .Values.xgt.enabled (not .Values.xgt.persistence.log.existingClaim) }} +{{- if and .Values.xgt.enabled (not .Values.xgt.files.existingClaim) (not .Values.xgt.persistence.log.existingClaim) }} --- apiVersion: v1 kind: PersistentVolumeClaim diff --git a/charts/rocketgraph/templates/xgt-tls-secret.yaml b/charts/rocketgraph/templates/xgt-tls-secret.yaml index 195c4c1..96e5948 100644 --- a/charts/rocketgraph/templates/xgt-tls-secret.yaml +++ b/charts/rocketgraph/templates/xgt-tls-secret.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.xgt.enabled .Values.xgt.ssl.enabled (not .Values.xgt.ssl.existingSecret) (or .Values.xgt.ssl.cert .Values.xgt.ssl.key .Values.xgt.ssl.caCert) }} +{{- if and .Values.xgt.enabled (not .Values.xgt.files.existingClaim) .Values.xgt.ssl.enabled (not .Values.xgt.ssl.existingSecret) (or .Values.xgt.ssl.cert .Values.xgt.ssl.key .Values.xgt.ssl.caCert) }} apiVersion: v1 kind: Secret metadata: diff --git a/charts/rocketgraph/tests/snapshots/default.yaml b/charts/rocketgraph/tests/snapshots/default.yaml new file mode 100644 index 0000000..f48828c --- /dev/null +++ b/charts/rocketgraph/tests/snapshots/default.yaml @@ -0,0 +1,625 @@ +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-frontend + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - ports: + - port: 80 + protocol: TCP + - port: 443 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-backend + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - from: + - podSelector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + ports: + - port: 5000 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-xgt + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: xgt + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - ports: + - port: 4367 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-mongodb + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: mongodb + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + - Egress + ingress: + - from: + - podSelector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + ports: + - port: 27017 + protocol: TCP + egress: + - ports: + - port: 53 + protocol: UDP + - port: 53 + protocol: TCP + +--- +# Source: rocketgraph/templates/xgt-configmap.yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-release-xgt-config + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +data: + audit.xml: | + + + + + + + + + + + + + + + + + + + + + grouplabel.csv: | + group,label + xgtd,xgtadmin + label.csv: | + label + xgtadmin + xgtd.conf: | + { + "audit.config_file": "/conf/audit.xml", + "license.location": "6200@localhost:/conf/licenses/xgtd.lic", + "logging.filepath": "/log", + "logging.fileprefix": "xgtd", + "logging.log_to_console": "true", + "security.adminlabel": "xgtadmin", + "security.grouplabelfile": "/conf/grouplabel.csv", + "security.labelfile": "/conf/label.csv", + "system.ssl_root_dir": "/conf/ssl", + "system.usemtls": "false", + "system.usessl": "false" + } + +--- +# Source: rocketgraph/templates/mongodb-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-mongodb-data + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- +# Source: rocketgraph/templates/xgt-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-xgt-data + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + +--- +# Source: rocketgraph/templates/xgt-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-xgt-log + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- +# Source: rocketgraph/templates/backend-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-backend + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + sessionAffinity: ClientIP + ports: + - name: http + port: 5000 + targetPort: 5000 + selector: + app: backend + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/frontend-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-frontend + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + ports: + - name: http + port: 80 + targetPort: 80 + - name: https + port: 443 + targetPort: 443 + selector: + app: frontend + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/mongodb-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-mongodb + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + ports: + - name: mongodb + port: 27017 + targetPort: 27017 + selector: + app: mongodb + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/xgt-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-xgt + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + sessionAffinity: ClientIP + ports: + - name: xgt + port: 4367 + targetPort: 4367 + selector: + app: xgt + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/backend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-backend + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + template: + metadata: + labels: + app: backend + app.kubernetes.io/instance: test-release + spec: + containers: + - name: backend + image: "docker.io/rocketgraph/mission-control-backend:2.7.0" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: http + containerPort: 5000 + protocol: TCP + env: + - name: MC_MONGO_URI + value: "mongodb://test-release-mongodb:27017" + - name: MC_DEFAULT_XGT_HOST + value: "test-release-xgt" + - name: MC_DEFAULT_XGT_PORT + value: "" + - name: MC_SESSION_TTL + value: "" + - name: XGT_SERVER_CN + value: "" + - name: XGT_AUTH_TYPES + value: "['BasicAuth', 'FilePKIAuth', 'PKIAuth']" + - name: LD_LIBRARY_PATH + value: "/odbc" + - name: MC_PORT + value: "80" + - name: MC_SSL_PORT + value: "443" + - name: MC_XGT_ALLOWED_HOSTS + value: "test-release-xgt:4367" + startupProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + readinessProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 60 + timeoutSeconds: 5 + failureThreshold: 5 + restartPolicy: Always + +--- +# Source: rocketgraph/templates/frontend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-frontend + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + template: + metadata: + labels: + app: frontend + app.kubernetes.io/instance: test-release + spec: + containers: + - name: frontend + image: "docker.io/rocketgraph/mission-control-frontend:2.7.0" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + env: + - name: BACKEND_HOST + value: "test-release-backend" + - name: BACKEND_PORT + value: "5000" + ports: + - name: http + containerPort: 80 + protocol: TCP + - name: https + containerPort: 443 + protocol: TCP + readinessProbe: + httpGet: + path: /health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /health + port: http + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + restartPolicy: Always + +--- +# Source: rocketgraph/templates/mongodb-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-mongodb + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: mongodb + app.kubernetes.io/instance: test-release + strategy: + type: Recreate + template: + metadata: + labels: + app: mongodb + app.kubernetes.io/instance: test-release + spec: + containers: + - name: mongodb + image: "docker.io/library/mongo:8.0.23" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: mongodb + containerPort: 27017 + protocol: TCP + readinessProbe: + exec: + # Wrapped in `sh -c` so the shell expands $MONGO_INITDB_ROOT_* — Kubernetes + # does NOT expand $(VAR) in exec probe commands (only in command/args), so + # the credentials must be expanded by a shell or auth always fails. + command: + - sh + - -c + - >- + mongosh + --eval "db.adminCommand('ping')" + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + exec: + # See readinessProbe note: $(VAR) is not expanded in exec probes, so wrap in `sh -c`. + command: + - sh + - -c + - >- + mongosh + --eval "db.adminCommand('ping')" + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + volumeMounts: + - name: mongodb-data + mountPath: /data/db + restartPolicy: Always + volumes: + - name: mongodb-data + persistentVolumeClaim: + claimName: test-release-mongodb-data + +--- +# Source: rocketgraph/templates/xgt-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-xgt + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: xgt + app.kubernetes.io/instance: test-release + strategy: + type: Recreate + template: + metadata: + labels: + app: xgt + app.kubernetes.io/instance: test-release + annotations: + checksum/config: 290f91d7dc1717af6598d81375db26883184b759d2b07ff3abceeb35af500758 + spec: + containers: + - name: xgt + image: "docker.io/rocketgraph/xgt:2.7.1" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: xgt + containerPort: 4367 + protocol: TCP + startupProbe: + grpc: + port: 4366 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + readinessProbe: + grpc: + port: 4366 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + grpc: + port: 4366 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + volumeMounts: + - name: xgt-config + mountPath: /conf/xgtd.conf + subPath: xgtd.conf + - name: xgt-config + mountPath: /conf/audit.xml + subPath: audit.xml + - name: xgt-config + mountPath: /conf/grouplabel.csv + subPath: grouplabel.csv + - name: xgt-config + mountPath: /conf/label.csv + subPath: label.csv + - name: xgt-data + mountPath: /data + - name: xgt-log + mountPath: /log + restartPolicy: Always + volumes: + - name: xgt-config + configMap: + name: test-release-xgt-config + - name: xgt-data + persistentVolumeClaim: + claimName: test-release-xgt-data + - name: xgt-log + persistentVolumeClaim: + claimName: test-release-xgt-log diff --git a/charts/rocketgraph/tests/snapshots/external-mongodb.yaml b/charts/rocketgraph/tests/snapshots/external-mongodb.yaml new file mode 100644 index 0000000..c92c274 --- /dev/null +++ b/charts/rocketgraph/tests/snapshots/external-mongodb.yaml @@ -0,0 +1,473 @@ +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-frontend + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - ports: + - port: 80 + protocol: TCP + - port: 443 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-backend + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - from: + - podSelector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + ports: + - port: 5000 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-xgt + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: xgt + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - ports: + - port: 4367 + protocol: TCP + +--- +# Source: rocketgraph/templates/xgt-configmap.yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-release-xgt-config + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +data: + audit.xml: | + + + + + + + + + + + + + + + + + + + + + grouplabel.csv: | + group,label + xgtd,xgtadmin + label.csv: | + label + xgtadmin + xgtd.conf: | + { + "audit.config_file": "/conf/audit.xml", + "license.location": "6200@localhost:/conf/licenses/xgtd.lic", + "logging.filepath": "/log", + "logging.fileprefix": "xgtd", + "logging.log_to_console": "true", + "security.adminlabel": "xgtadmin", + "security.grouplabelfile": "/conf/grouplabel.csv", + "security.labelfile": "/conf/label.csv", + "system.ssl_root_dir": "/conf/ssl", + "system.usemtls": "false", + "system.usessl": "false" + } + +--- +# Source: rocketgraph/templates/xgt-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-xgt-data + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + +--- +# Source: rocketgraph/templates/xgt-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-xgt-log + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- +# Source: rocketgraph/templates/backend-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-backend + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + sessionAffinity: ClientIP + ports: + - name: http + port: 5000 + targetPort: 5000 + selector: + app: backend + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/frontend-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-frontend + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + ports: + - name: http + port: 80 + targetPort: 80 + - name: https + port: 443 + targetPort: 443 + selector: + app: frontend + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/xgt-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-xgt + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + sessionAffinity: ClientIP + ports: + - name: xgt + port: 4367 + targetPort: 4367 + selector: + app: xgt + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/backend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-backend + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + template: + metadata: + labels: + app: backend + app.kubernetes.io/instance: test-release + spec: + containers: + - name: backend + image: "docker.io/rocketgraph/mission-control-backend:2.7.0" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: http + containerPort: 5000 + protocol: TCP + env: + - name: MC_MONGO_URI + value: "mongodb://user:pass@external-host:27017/dbname" + - name: MC_DEFAULT_XGT_HOST + value: "test-release-xgt" + - name: MC_DEFAULT_XGT_PORT + value: "" + - name: MC_SESSION_TTL + value: "" + - name: XGT_SERVER_CN + value: "" + - name: XGT_AUTH_TYPES + value: "['BasicAuth', 'FilePKIAuth', 'PKIAuth']" + - name: LD_LIBRARY_PATH + value: "/odbc" + - name: MC_PORT + value: "80" + - name: MC_SSL_PORT + value: "443" + - name: MC_XGT_ALLOWED_HOSTS + value: "test-release-xgt:4367" + startupProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + readinessProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 60 + timeoutSeconds: 5 + failureThreshold: 5 + restartPolicy: Always + +--- +# Source: rocketgraph/templates/frontend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-frontend + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + template: + metadata: + labels: + app: frontend + app.kubernetes.io/instance: test-release + spec: + containers: + - name: frontend + image: "docker.io/rocketgraph/mission-control-frontend:2.7.0" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + env: + - name: BACKEND_HOST + value: "test-release-backend" + - name: BACKEND_PORT + value: "5000" + ports: + - name: http + containerPort: 80 + protocol: TCP + - name: https + containerPort: 443 + protocol: TCP + readinessProbe: + httpGet: + path: /health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /health + port: http + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + restartPolicy: Always + +--- +# Source: rocketgraph/templates/xgt-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-xgt + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: xgt + app.kubernetes.io/instance: test-release + strategy: + type: Recreate + template: + metadata: + labels: + app: xgt + app.kubernetes.io/instance: test-release + annotations: + checksum/config: 290f91d7dc1717af6598d81375db26883184b759d2b07ff3abceeb35af500758 + spec: + containers: + - name: xgt + image: "docker.io/rocketgraph/xgt:2.7.1" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: xgt + containerPort: 4367 + protocol: TCP + startupProbe: + grpc: + port: 4366 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + readinessProbe: + grpc: + port: 4366 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + grpc: + port: 4366 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + volumeMounts: + - name: xgt-config + mountPath: /conf/xgtd.conf + subPath: xgtd.conf + - name: xgt-config + mountPath: /conf/audit.xml + subPath: audit.xml + - name: xgt-config + mountPath: /conf/grouplabel.csv + subPath: grouplabel.csv + - name: xgt-config + mountPath: /conf/label.csv + subPath: label.csv + - name: xgt-data + mountPath: /data + - name: xgt-log + mountPath: /log + restartPolicy: Always + volumes: + - name: xgt-config + configMap: + name: test-release-xgt-config + - name: xgt-data + persistentVolumeClaim: + claimName: test-release-xgt-data + - name: xgt-log + persistentVolumeClaim: + claimName: test-release-xgt-log diff --git a/charts/rocketgraph/tests/snapshots/external-xgt.yaml b/charts/rocketgraph/tests/snapshots/external-xgt.yaml new file mode 100644 index 0000000..6cc6773 --- /dev/null +++ b/charts/rocketgraph/tests/snapshots/external-xgt.yaml @@ -0,0 +1,395 @@ +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-frontend + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - ports: + - port: 80 + protocol: TCP + - port: 443 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-backend + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - from: + - podSelector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + ports: + - port: 5000 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-mongodb + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: mongodb + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + - Egress + ingress: + - from: + - podSelector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + ports: + - port: 27017 + protocol: TCP + egress: + - ports: + - port: 53 + protocol: UDP + - port: 53 + protocol: TCP + +--- +# Source: rocketgraph/templates/mongodb-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-mongodb-data + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- +# Source: rocketgraph/templates/backend-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-backend + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + sessionAffinity: ClientIP + ports: + - name: http + port: 5000 + targetPort: 5000 + selector: + app: backend + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/frontend-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-frontend + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + ports: + - name: http + port: 80 + targetPort: 80 + - name: https + port: 443 + targetPort: 443 + selector: + app: frontend + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/mongodb-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-mongodb + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + ports: + - name: mongodb + port: 27017 + targetPort: 27017 + selector: + app: mongodb + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/backend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-backend + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + template: + metadata: + labels: + app: backend + app.kubernetes.io/instance: test-release + spec: + containers: + - name: backend + image: "docker.io/rocketgraph/mission-control-backend:2.7.0" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: http + containerPort: 5000 + protocol: TCP + env: + - name: MC_MONGO_URI + value: "mongodb://test-release-mongodb:27017" + - name: MC_DEFAULT_XGT_HOST + value: "xgt.example.com" + - name: MC_DEFAULT_XGT_PORT + value: "" + - name: MC_SESSION_TTL + value: "" + - name: XGT_SERVER_CN + value: "" + - name: XGT_AUTH_TYPES + value: "['BasicAuth', 'FilePKIAuth', 'PKIAuth']" + - name: LD_LIBRARY_PATH + value: "/odbc" + - name: MC_PORT + value: "80" + - name: MC_SSL_PORT + value: "443" + - name: MC_XGT_ALLOWED_HOSTS + value: "" + startupProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + readinessProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 60 + timeoutSeconds: 5 + failureThreshold: 5 + restartPolicy: Always + +--- +# Source: rocketgraph/templates/frontend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-frontend + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + template: + metadata: + labels: + app: frontend + app.kubernetes.io/instance: test-release + spec: + containers: + - name: frontend + image: "docker.io/rocketgraph/mission-control-frontend:2.7.0" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + env: + - name: BACKEND_HOST + value: "test-release-backend" + - name: BACKEND_PORT + value: "5000" + ports: + - name: http + containerPort: 80 + protocol: TCP + - name: https + containerPort: 443 + protocol: TCP + readinessProbe: + httpGet: + path: /health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /health + port: http + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + restartPolicy: Always + +--- +# Source: rocketgraph/templates/mongodb-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-mongodb + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: mongodb + app.kubernetes.io/instance: test-release + strategy: + type: Recreate + template: + metadata: + labels: + app: mongodb + app.kubernetes.io/instance: test-release + spec: + containers: + - name: mongodb + image: "docker.io/library/mongo:8.0.23" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: mongodb + containerPort: 27017 + protocol: TCP + readinessProbe: + exec: + # Wrapped in `sh -c` so the shell expands $MONGO_INITDB_ROOT_* — Kubernetes + # does NOT expand $(VAR) in exec probe commands (only in command/args), so + # the credentials must be expanded by a shell or auth always fails. + command: + - sh + - -c + - >- + mongosh + --eval "db.adminCommand('ping')" + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + exec: + # See readinessProbe note: $(VAR) is not expanded in exec probes, so wrap in `sh -c`. + command: + - sh + - -c + - >- + mongosh + --eval "db.adminCommand('ping')" + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + volumeMounts: + - name: mongodb-data + mountPath: /data/db + restartPolicy: Always + volumes: + - name: mongodb-data + persistentVolumeClaim: + claimName: test-release-mongodb-data diff --git a/charts/rocketgraph/tests/snapshots/ldap.yaml b/charts/rocketgraph/tests/snapshots/ldap.yaml new file mode 100644 index 0000000..be1cc83 --- /dev/null +++ b/charts/rocketgraph/tests/snapshots/ldap.yaml @@ -0,0 +1,666 @@ +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-frontend + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - ports: + - port: 80 + protocol: TCP + - port: 443 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-backend + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - from: + - podSelector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + ports: + - port: 5000 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-xgt + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: xgt + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - ports: + - port: 4367 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-mongodb + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: mongodb + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + - Egress + ingress: + - from: + - podSelector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + ports: + - port: 27017 + protocol: TCP + egress: + - ports: + - port: 53 + protocol: UDP + - port: 53 + protocol: TCP + +--- +# Source: rocketgraph/templates/xgt-ldap-secret.yaml +apiVersion: v1 +kind: Secret +metadata: + name: test-release-xgt-ldap + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +type: Opaque +stringData: + sssd.conf: | + [sssd] + services = nss, pam + domains = LDAP + + [pam] + pam_trusted_users = 0 + + [domain/LDAP] + id_provider = ldap + auth_provider = ldap + ldap_uri = ldap://ldap.example.org + ldap_search_base = dc=example,dc=org + ldap_default_bind_dn = cn=admin,dc=example,dc=org + ldap_default_authtok = secret + +--- +# Source: rocketgraph/templates/xgt-configmap.yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-release-xgt-config + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +data: + audit.xml: | + + + + + + + + + + + + + + + + + + + + + grouplabel.csv: | + group,label + xgtd,xgtadmin + label.csv: | + label + xgtadmin + xgtd.conf: | + { + "audit.config_file": "/conf/audit.xml", + "license.location": "6200@localhost:/conf/licenses/xgtd.lic", + "logging.filepath": "/log", + "logging.fileprefix": "xgtd", + "logging.log_to_console": "true", + "security.adminlabel": "xgtadmin", + "security.grouplabelfile": "/conf/grouplabel.csv", + "security.labelfile": "/conf/label.csv", + "system.ssl_root_dir": "/conf/ssl", + "system.usemtls": "false", + "system.usessl": "false" + } + +--- +# Source: rocketgraph/templates/mongodb-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-mongodb-data + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- +# Source: rocketgraph/templates/xgt-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-xgt-data + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + +--- +# Source: rocketgraph/templates/xgt-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-xgt-log + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- +# Source: rocketgraph/templates/backend-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-backend + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + sessionAffinity: ClientIP + ports: + - name: http + port: 5000 + targetPort: 5000 + selector: + app: backend + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/frontend-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-frontend + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + ports: + - name: http + port: 80 + targetPort: 80 + - name: https + port: 443 + targetPort: 443 + selector: + app: frontend + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/mongodb-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-mongodb + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + ports: + - name: mongodb + port: 27017 + targetPort: 27017 + selector: + app: mongodb + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/xgt-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-xgt + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + sessionAffinity: ClientIP + ports: + - name: xgt + port: 4367 + targetPort: 4367 + selector: + app: xgt + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/backend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-backend + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + template: + metadata: + labels: + app: backend + app.kubernetes.io/instance: test-release + spec: + containers: + - name: backend + image: "docker.io/rocketgraph/mission-control-backend:2.7.0" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: http + containerPort: 5000 + protocol: TCP + env: + - name: MC_MONGO_URI + value: "mongodb://test-release-mongodb:27017" + - name: MC_DEFAULT_XGT_HOST + value: "test-release-xgt" + - name: MC_DEFAULT_XGT_PORT + value: "" + - name: MC_SESSION_TTL + value: "" + - name: XGT_SERVER_CN + value: "" + - name: XGT_AUTH_TYPES + value: "['BasicAuth', 'FilePKIAuth', 'PKIAuth']" + - name: LD_LIBRARY_PATH + value: "/odbc" + - name: MC_PORT + value: "80" + - name: MC_SSL_PORT + value: "443" + - name: MC_XGT_ALLOWED_HOSTS + value: "test-release-xgt:4367" + startupProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + readinessProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 60 + timeoutSeconds: 5 + failureThreshold: 5 + restartPolicy: Always + +--- +# Source: rocketgraph/templates/frontend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-frontend + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + template: + metadata: + labels: + app: frontend + app.kubernetes.io/instance: test-release + spec: + containers: + - name: frontend + image: "docker.io/rocketgraph/mission-control-frontend:2.7.0" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + env: + - name: BACKEND_HOST + value: "test-release-backend" + - name: BACKEND_PORT + value: "5000" + ports: + - name: http + containerPort: 80 + protocol: TCP + - name: https + containerPort: 443 + protocol: TCP + readinessProbe: + httpGet: + path: /health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /health + port: http + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + restartPolicy: Always + +--- +# Source: rocketgraph/templates/mongodb-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-mongodb + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: mongodb + app.kubernetes.io/instance: test-release + strategy: + type: Recreate + template: + metadata: + labels: + app: mongodb + app.kubernetes.io/instance: test-release + spec: + containers: + - name: mongodb + image: "docker.io/library/mongo:8.0.23" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: mongodb + containerPort: 27017 + protocol: TCP + readinessProbe: + exec: + # Wrapped in `sh -c` so the shell expands $MONGO_INITDB_ROOT_* — Kubernetes + # does NOT expand $(VAR) in exec probe commands (only in command/args), so + # the credentials must be expanded by a shell or auth always fails. + command: + - sh + - -c + - >- + mongosh + --eval "db.adminCommand('ping')" + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + exec: + # See readinessProbe note: $(VAR) is not expanded in exec probes, so wrap in `sh -c`. + command: + - sh + - -c + - >- + mongosh + --eval "db.adminCommand('ping')" + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + volumeMounts: + - name: mongodb-data + mountPath: /data/db + restartPolicy: Always + volumes: + - name: mongodb-data + persistentVolumeClaim: + claimName: test-release-mongodb-data + +--- +# Source: rocketgraph/templates/xgt-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-xgt + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: xgt + app.kubernetes.io/instance: test-release + strategy: + type: Recreate + template: + metadata: + labels: + app: xgt + app.kubernetes.io/instance: test-release + annotations: + checksum/config: 290f91d7dc1717af6598d81375db26883184b759d2b07ff3abceeb35af500758 + spec: + containers: + - name: xgt + image: "docker.io/rocketgraph/xgt:2.7.1" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: xgt + containerPort: 4367 + protocol: TCP + startupProbe: + grpc: + port: 4366 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + readinessProbe: + grpc: + port: 4366 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + grpc: + port: 4366 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + volumeMounts: + - name: xgt-config + mountPath: /conf/xgtd.conf + subPath: xgtd.conf + - name: xgt-config + mountPath: /conf/audit.xml + subPath: audit.xml + - name: xgt-config + mountPath: /conf/grouplabel.csv + subPath: grouplabel.csv + - name: xgt-config + mountPath: /conf/label.csv + subPath: label.csv + - name: xgt-data + mountPath: /data + - name: xgt-log + mountPath: /log + - name: sssd-config + mountPath: /etc/sssd-config + readOnly: true + restartPolicy: Always + volumes: + - name: xgt-config + configMap: + name: test-release-xgt-config + - name: xgt-data + persistentVolumeClaim: + claimName: test-release-xgt-data + - name: xgt-log + persistentVolumeClaim: + claimName: test-release-xgt-log + - name: sssd-config + secret: + secretName: test-release-xgt-ldap + items: + - key: sssd.conf + path: sssd.conf + mode: 0600 diff --git a/charts/rocketgraph/tests/snapshots/openshift.yaml b/charts/rocketgraph/tests/snapshots/openshift.yaml new file mode 100644 index 0000000..2a78a51 --- /dev/null +++ b/charts/rocketgraph/tests/snapshots/openshift.yaml @@ -0,0 +1,663 @@ +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-frontend + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - ports: + - port: 80 + protocol: TCP + - port: 443 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-backend + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - from: + - podSelector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + ports: + - port: 5000 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-xgt + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: xgt + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - ports: + - port: 4367 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-mongodb + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: mongodb + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + - Egress + ingress: + - from: + - podSelector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + ports: + - port: 27017 + protocol: TCP + egress: + - ports: + - port: 53 + protocol: UDP + - port: 53 + protocol: TCP + +--- +# Source: rocketgraph/templates/serviceaccount.yaml +apiVersion: v1 +kind: ServiceAccount +metadata: + name: test-release-rocketgraph + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/xgt-configmap.yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-release-xgt-config + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +data: + audit.xml: | + + + + + + + + + + + + + + + + + + + + + grouplabel.csv: | + group,label + xgtd,xgtadmin + label.csv: | + label + xgtadmin + xgtd.conf: | + { + "audit.config_file": "/conf/audit.xml", + "license.location": "6200@localhost:/conf/licenses/xgtd.lic", + "logging.filepath": "/log", + "logging.fileprefix": "xgtd", + "logging.log_to_console": "true", + "security.adminlabel": "xgtadmin", + "security.grouplabelfile": "/conf/grouplabel.csv", + "security.labelfile": "/conf/label.csv", + "system.ssl_root_dir": "/conf/ssl", + "system.usemtls": "false", + "system.usessl": "false" + } + +--- +# Source: rocketgraph/templates/mongodb-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-mongodb-data + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- +# Source: rocketgraph/templates/xgt-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-xgt-data + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + +--- +# Source: rocketgraph/templates/xgt-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-xgt-log + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- +# Source: rocketgraph/templates/scc.yaml +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: test-release-rocketgraph-anyuid-default + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: system:openshift:scc:anyuid +subjects: + - kind: ServiceAccount + name: test-release-rocketgraph + namespace: default + +--- +# Source: rocketgraph/templates/backend-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-backend + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + sessionAffinity: ClientIP + ports: + - name: http + port: 5000 + targetPort: 5000 + selector: + app: backend + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/frontend-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-frontend + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + ports: + - name: http + port: 80 + targetPort: 80 + - name: https + port: 443 + targetPort: 443 + selector: + app: frontend + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/mongodb-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-mongodb + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + ports: + - name: mongodb + port: 27017 + targetPort: 27017 + selector: + app: mongodb + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/xgt-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-xgt + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + sessionAffinity: ClientIP + ports: + - name: xgt + port: 4367 + targetPort: 4367 + selector: + app: xgt + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/backend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-backend + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + template: + metadata: + labels: + app: backend + app.kubernetes.io/instance: test-release + spec: + serviceAccountName: test-release-rocketgraph + containers: + - name: backend + image: "docker.io/rocketgraph/mission-control-backend:2.7.0" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: http + containerPort: 5000 + protocol: TCP + env: + - name: MC_MONGO_URI + value: "mongodb://test-release-mongodb:27017" + - name: MC_DEFAULT_XGT_HOST + value: "test-release-xgt" + - name: MC_DEFAULT_XGT_PORT + value: "" + - name: MC_SESSION_TTL + value: "" + - name: XGT_SERVER_CN + value: "" + - name: XGT_AUTH_TYPES + value: "['BasicAuth', 'FilePKIAuth', 'PKIAuth']" + - name: LD_LIBRARY_PATH + value: "/odbc" + - name: MC_PORT + value: "80" + - name: MC_SSL_PORT + value: "443" + - name: MC_XGT_ALLOWED_HOSTS + value: "test-release-xgt:4367" + startupProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + readinessProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 60 + timeoutSeconds: 5 + failureThreshold: 5 + restartPolicy: Always + +--- +# Source: rocketgraph/templates/frontend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-frontend + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + template: + metadata: + labels: + app: frontend + app.kubernetes.io/instance: test-release + spec: + serviceAccountName: test-release-rocketgraph + containers: + - name: frontend + image: "docker.io/rocketgraph/mission-control-frontend:2.7.0" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + env: + - name: BACKEND_HOST + value: "test-release-backend" + - name: BACKEND_PORT + value: "5000" + ports: + - name: http + containerPort: 80 + protocol: TCP + - name: https + containerPort: 443 + protocol: TCP + readinessProbe: + httpGet: + path: /health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /health + port: http + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + restartPolicy: Always + +--- +# Source: rocketgraph/templates/mongodb-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-mongodb + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: mongodb + app.kubernetes.io/instance: test-release + strategy: + type: Recreate + template: + metadata: + labels: + app: mongodb + app.kubernetes.io/instance: test-release + spec: + serviceAccountName: test-release-rocketgraph + containers: + - name: mongodb + image: "docker.io/library/mongo:8.0.23" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: mongodb + containerPort: 27017 + protocol: TCP + readinessProbe: + exec: + # Wrapped in `sh -c` so the shell expands $MONGO_INITDB_ROOT_* — Kubernetes + # does NOT expand $(VAR) in exec probe commands (only in command/args), so + # the credentials must be expanded by a shell or auth always fails. + command: + - sh + - -c + - >- + mongosh + --eval "db.adminCommand('ping')" + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + exec: + # See readinessProbe note: $(VAR) is not expanded in exec probes, so wrap in `sh -c`. + command: + - sh + - -c + - >- + mongosh + --eval "db.adminCommand('ping')" + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + volumeMounts: + - name: mongodb-data + mountPath: /data/db + restartPolicy: Always + volumes: + - name: mongodb-data + persistentVolumeClaim: + claimName: test-release-mongodb-data + +--- +# Source: rocketgraph/templates/xgt-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-xgt + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: xgt + app.kubernetes.io/instance: test-release + strategy: + type: Recreate + template: + metadata: + labels: + app: xgt + app.kubernetes.io/instance: test-release + annotations: + checksum/config: 290f91d7dc1717af6598d81375db26883184b759d2b07ff3abceeb35af500758 + spec: + serviceAccountName: test-release-rocketgraph + containers: + - name: xgt + image: "docker.io/rocketgraph/xgt:2.7.1" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: xgt + containerPort: 4367 + protocol: TCP + startupProbe: + grpc: + port: 4366 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + readinessProbe: + grpc: + port: 4366 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + grpc: + port: 4366 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + volumeMounts: + - name: xgt-config + mountPath: /conf/xgtd.conf + subPath: xgtd.conf + - name: xgt-config + mountPath: /conf/audit.xml + subPath: audit.xml + - name: xgt-config + mountPath: /conf/grouplabel.csv + subPath: grouplabel.csv + - name: xgt-config + mountPath: /conf/label.csv + subPath: label.csv + - name: xgt-data + mountPath: /data + - name: xgt-log + mountPath: /log + restartPolicy: Always + volumes: + - name: xgt-config + configMap: + name: test-release-xgt-config + - name: xgt-data + persistentVolumeClaim: + claimName: test-release-xgt-data + - name: xgt-log + persistentVolumeClaim: + claimName: test-release-xgt-log diff --git a/charts/rocketgraph/tests/snapshots/tls.yaml b/charts/rocketgraph/tests/snapshots/tls.yaml new file mode 100644 index 0000000..4ae978f --- /dev/null +++ b/charts/rocketgraph/tests/snapshots/tls.yaml @@ -0,0 +1,714 @@ +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-frontend + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - ports: + - port: 80 + protocol: TCP + - port: 443 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-backend + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - from: + - podSelector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + ports: + - port: 5000 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-xgt + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: xgt + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + ingress: + - ports: + - port: 4367 + protocol: TCP + +--- +# Source: rocketgraph/templates/networkpolicy.yaml +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: test-release-mongodb + labels: + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + podSelector: + matchLabels: + app: mongodb + app.kubernetes.io/instance: test-release + policyTypes: + - Ingress + - Egress + ingress: + - from: + - podSelector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + ports: + - port: 27017 + protocol: TCP + egress: + - ports: + - port: 53 + protocol: UDP + - port: 53 + protocol: TCP + +--- +# Source: rocketgraph/templates/backend-tls-secret.yaml +apiVersion: v1 +kind: Secret +metadata: + name: test-release-backend-tls + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +type: Opaque +stringData: + xgt-server.pem: "test-ca" + proxy-client-cert.pem: "test-client-cert" + proxy-client-key.pem: "test-client-key" + +--- +# Source: rocketgraph/templates/frontend-tls-secret.yaml +apiVersion: v1 +kind: Secret +metadata: + name: test-release-frontend-tls + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +type: Opaque +stringData: + public.pem: "test-cert" + private.pem: "test-key" + +--- +# Source: rocketgraph/templates/xgt-tls-secret.yaml +apiVersion: v1 +kind: Secret +metadata: + name: test-release-xgt-tls + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +type: Opaque +stringData: + server.cert.pem: "test-xgt-cert" + server.key.pem: "test-xgt-key" + +--- +# Source: rocketgraph/templates/xgt-configmap.yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: test-release-xgt-config + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +data: + audit.xml: | + + + + + + + + + + + + + + + + + + + + + grouplabel.csv: | + group,label + xgtd,xgtadmin + label.csv: | + label + xgtadmin + xgtd.conf: | + { + "audit.config_file": "/conf/audit.xml", + "license.location": "6200@localhost:/conf/licenses/xgtd.lic", + "logging.filepath": "/log", + "logging.fileprefix": "xgtd", + "logging.log_to_console": "true", + "security.adminlabel": "xgtadmin", + "security.grouplabelfile": "/conf/grouplabel.csv", + "security.labelfile": "/conf/label.csv", + "system.ssl_root_dir": "/conf/ssl", + "system.usemtls": "false", + "system.usessl": "true" + } + +--- +# Source: rocketgraph/templates/mongodb-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-mongodb-data + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- +# Source: rocketgraph/templates/xgt-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-xgt-data + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 10Gi + +--- +# Source: rocketgraph/templates/xgt-pvc.yaml +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: test-release-xgt-log + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + +--- +# Source: rocketgraph/templates/backend-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-backend + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + sessionAffinity: ClientIP + ports: + - name: http + port: 5000 + targetPort: 5000 + selector: + app: backend + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/frontend-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-frontend + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + ports: + - name: http + port: 80 + targetPort: 80 + - name: https + port: 443 + targetPort: 443 + selector: + app: frontend + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/mongodb-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-mongodb + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + ports: + - name: mongodb + port: 27017 + targetPort: 27017 + selector: + app: mongodb + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/xgt-service.yaml +apiVersion: v1 +kind: Service +metadata: + name: test-release-xgt + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + type: ClusterIP + sessionAffinity: ClientIP + ports: + - name: xgt + port: 4367 + targetPort: 4367 + selector: + app: xgt + app.kubernetes.io/instance: test-release + +--- +# Source: rocketgraph/templates/backend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-backend + labels: + app: backend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: backend + app.kubernetes.io/instance: test-release + template: + metadata: + labels: + app: backend + app.kubernetes.io/instance: test-release + spec: + containers: + - name: backend + image: "docker.io/rocketgraph/mission-control-backend:2.7.0" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: http + containerPort: 5000 + protocol: TCP + env: + - name: MC_MONGO_URI + value: "mongodb://test-release-mongodb:27017" + - name: MC_DEFAULT_XGT_HOST + value: "test-release-xgt" + - name: MC_DEFAULT_XGT_PORT + value: "" + - name: MC_SESSION_TTL + value: "" + - name: XGT_SERVER_CN + value: "test-release-xgt" + - name: XGT_AUTH_TYPES + value: "['BasicAuth', 'FilePKIAuth', 'PKIAuth']" + - name: LD_LIBRARY_PATH + value: "/odbc" + - name: MC_PORT + value: "80" + - name: MC_SSL_PORT + value: "443" + - name: MC_XGT_ALLOWED_HOSTS + value: "test-release-xgt:4367" + startupProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + readinessProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /api/health + port: http + periodSeconds: 60 + timeoutSeconds: 5 + failureThreshold: 5 + volumeMounts: + - name: tls-certs + mountPath: /etc/ssl/certs/xgt-server.pem + subPath: xgt-server.pem + readOnly: true + restartPolicy: Always + volumes: + - name: tls-certs + secret: + secretName: test-release-backend-tls + +--- +# Source: rocketgraph/templates/frontend-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-frontend + labels: + app: frontend + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: frontend + app.kubernetes.io/instance: test-release + template: + metadata: + labels: + app: frontend + app.kubernetes.io/instance: test-release + spec: + containers: + - name: frontend + image: "docker.io/rocketgraph/mission-control-frontend:2.7.0" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + env: + - name: BACKEND_HOST + value: "test-release-backend" + - name: BACKEND_PORT + value: "5000" + ports: + - name: http + containerPort: 80 + protocol: TCP + - name: https + containerPort: 443 + protocol: TCP + readinessProbe: + httpGet: + path: /health + port: http + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + httpGet: + path: /health + port: http + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + volumeMounts: + - name: tls-certs + mountPath: /etc/ssl/certs/td.pem + subPath: public.pem + readOnly: true + - name: tls-certs + mountPath: /etc/ssl/private/td.pem + subPath: private.pem + readOnly: true + restartPolicy: Always + volumes: + - name: tls-certs + secret: + secretName: test-release-frontend-tls + +--- +# Source: rocketgraph/templates/mongodb-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-mongodb + labels: + app: mongodb + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: mongodb + app.kubernetes.io/instance: test-release + strategy: + type: Recreate + template: + metadata: + labels: + app: mongodb + app.kubernetes.io/instance: test-release + spec: + containers: + - name: mongodb + image: "docker.io/library/mongo:8.0.23" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: mongodb + containerPort: 27017 + protocol: TCP + readinessProbe: + exec: + # Wrapped in `sh -c` so the shell expands $MONGO_INITDB_ROOT_* — Kubernetes + # does NOT expand $(VAR) in exec probe commands (only in command/args), so + # the credentials must be expanded by a shell or auth always fails. + command: + - sh + - -c + - >- + mongosh + --eval "db.adminCommand('ping')" + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + exec: + # See readinessProbe note: $(VAR) is not expanded in exec probes, so wrap in `sh -c`. + command: + - sh + - -c + - >- + mongosh + --eval "db.adminCommand('ping')" + initialDelaySeconds: 10 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + volumeMounts: + - name: mongodb-data + mountPath: /data/db + restartPolicy: Always + volumes: + - name: mongodb-data + persistentVolumeClaim: + claimName: test-release-mongodb-data + +--- +# Source: rocketgraph/templates/xgt-deployment.yaml +apiVersion: apps/v1 +kind: Deployment +metadata: + name: test-release-xgt + labels: + app: xgt + helm.sh/chart: rocketgraph-0.4.0 + app.kubernetes.io/name: rocketgraph + app.kubernetes.io/version: "2.7.0" + app.kubernetes.io/managed-by: Helm + app.kubernetes.io/instance: test-release +spec: + replicas: 1 + selector: + matchLabels: + app: xgt + app.kubernetes.io/instance: test-release + strategy: + type: Recreate + template: + metadata: + labels: + app: xgt + app.kubernetes.io/instance: test-release + annotations: + checksum/config: 019e668f8163b2c54d737b72aa245ba6914971d0e482e5de0d15bde056ad906e + spec: + containers: + - name: xgt + image: "docker.io/rocketgraph/xgt:2.7.1" + imagePullPolicy: IfNotPresent + securityContext: + allowPrivilegeEscalation: false + ports: + - name: xgt + containerPort: 4367 + protocol: TCP + startupProbe: + grpc: + port: 4366 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 30 + readinessProbe: + grpc: + port: 4366 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 3 + livenessProbe: + grpc: + port: 4366 + periodSeconds: 30 + timeoutSeconds: 5 + failureThreshold: 3 + volumeMounts: + - name: xgt-config + mountPath: /conf/xgtd.conf + subPath: xgtd.conf + - name: xgt-config + mountPath: /conf/audit.xml + subPath: audit.xml + - name: xgt-config + mountPath: /conf/grouplabel.csv + subPath: grouplabel.csv + - name: xgt-config + mountPath: /conf/label.csv + subPath: label.csv + - name: xgt-data + mountPath: /data + - name: xgt-log + mountPath: /log + - name: xgt-tls + mountPath: /conf/ssl + readOnly: true + restartPolicy: Always + volumes: + - name: xgt-config + configMap: + name: test-release-xgt-config + - name: xgt-data + persistentVolumeClaim: + claimName: test-release-xgt-data + - name: xgt-log + persistentVolumeClaim: + claimName: test-release-xgt-log + - name: xgt-tls + secret: + secretName: test-release-xgt-tls + items: + - key: server.cert.pem + path: certs/server.cert.pem + - key: server.key.pem + path: private/server.key.pem + mode: 0400 diff --git a/charts/rocketgraph/tests/test_render.py b/charts/rocketgraph/tests/test_render.py new file mode 100644 index 0000000..88c20b5 --- /dev/null +++ b/charts/rocketgraph/tests/test_render.py @@ -0,0 +1,491 @@ +"""Render checks: HELM_BIN=/path/to/helm python -m unittest discover -s tests. + +Requires PyYAML; no cluster access or Helm plugins are needed. +""" +import json +import os +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + +import yaml + +CHART = Path(__file__).resolve().parents[1] +HELM = os.environ.get('HELM_BIN', 'helm') + + +def render(values, release='test', fails=False, chart=CHART): + with tempfile.TemporaryDirectory() as directory: + path = Path(directory) / 'values.yaml' + path.write_text(yaml.safe_dump(values)) + result = subprocess.run( + [HELM, 'template', release, str(chart), '-n', 'test', '-f', str(path)], + capture_output=True, text=True) + if fails: + if result.returncode == 0: + raise AssertionError('Invalid values unexpectedly rendered') + return result.stderr + if result.returncode: + raise AssertionError(result.stderr) + return [obj for obj in yaml.safe_load_all(result.stdout) if obj] + + +def component(objects, kind, app): + return next(obj for obj in objects if obj['kind'] == kind + and obj['metadata']['labels'].get('app') == app) + + +class ReleaseTests(unittest.TestCase): + def test_default_keeps_full_stack_and_generated_hostname(self): + objects = render({}) + apps = {obj['metadata']['labels']['app'] for obj in objects + if obj['kind'] == 'Deployment'} + self.assertEqual(apps, {'frontend', 'backend', 'mongodb', 'xgt'}) + self.assertNotIn('hostname', component(objects, 'Deployment', 'xgt') + ['spec']['template']['spec']) + + def test_three_releases_have_isolated_storage_and_fixed_hostnames(self): + seen = set() + for environment in ['dev', 'test', 'prod']: + release = 'xgt-' + environment + objects = render({ + 'missionControl': {'enabled': False}, + 'mongodb': {'enabled': False}, + 'openshift': {'enabled': True}, + 'fips': {'enabled': True}, + 'xgt': {'hostname': release + '-0', + 'license': {'existingSecret': release + '-license'}, + 'ssl': {'enabled': True, 'existingSecret': release + '-tls'}, + 'extraConfig': {'security.oidc': {'client_id': release}}}, + 'backend': {'oidc': {'caCertExistingSecret': 'oidc-ca'}}}, release) + deployments = [obj for obj in objects if obj['kind'] == 'Deployment'] + self.assertEqual(len(deployments), 1) + pod = deployments[0]['spec']['template']['spec'] + self.assertEqual(pod['hostname'], release + '-0') + self.assertEqual(pod['containers'][0]['image'], + 'docker.io/rocketgraph/xgt:2.7.1-fips') + secrets = {v['secret']['secretName'] for v in pod['volumes'] if 'secret' in v} + self.assertEqual(secrets, {release + '-license', release + '-tls', 'oidc-ca'}) + claims = {v['persistentVolumeClaim']['claimName'] for v in pod['volumes'] + if 'persistentVolumeClaim' in v} + self.assertEqual(claims, {release + '-xgt-data', release + '-xgt-log'}) + self.assertTrue(claims.isdisjoint(seen)) + seen.update(claims) + created = {o['metadata']['name'] for o in objects + if o['kind'] == 'PersistentVolumeClaim'} + self.assertEqual(claims, created) + config = component(objects, 'ConfigMap', 'xgt') + self.assertEqual(json.loads(config['data']['xgtd.conf']) + ['security.oidc']['client_id'], release) + + def test_disabled_mission_control_omits_all_its_resources(self): + objects = render({ + 'missionControl': {'enabled': False}, 'mongodb': {'enabled': False}, + 'ingress': {'enabled': True}, + 'frontend': {'tls': {'publicCert': 'unused'}, + 'podDisruptionBudget': {'enabled': True}}, + 'backend': {'replicas': 2, 'siteConfig': {'yml': 'unused'}, + 'tls': {'xgtServerCert': 'unused'}, + 'odbc': {'enabled': True}, 'iaccess': {'enabled': True}, + 'oidc': {'clientSecret': 'unused'}, + 'podDisruptionBudget': {'enabled': True}}}) + self.assertFalse(any(o['metadata']['labels'].get('app') in ['frontend', 'backend'] + for o in objects)) + self.assertFalse(any(o['kind'] == 'Ingress' for o in objects)) + policies = [o['metadata']['name'] for o in objects if o['kind'] == 'NetworkPolicy'] + self.assertEqual(policies, ['test-xgt']) + + def test_xgt_only_keeps_inline_oidc_ca_without_client_secret(self): + objects = render({'missionControl': {'enabled': False}, + 'mongodb': {'enabled': False}, + 'backend': {'oidc': {'caCert': 'test-ca', + 'clientSecret': 'unused'}}}) + secrets = [o for o in objects if o['kind'] == 'Secret'] + self.assertEqual([s['stringData'] for s in secrets], [{'oidc-ca.pem': 'test-ca'}]) + pod = component(objects, 'Deployment', 'xgt')['spec']['template']['spec'] + ca = next(v for v in pod['volumes'] if v['name'] == 'oidc-ca-cert') + self.assertEqual(ca['secret']['secretName'], secrets[0]['metadata']['name']) + + def test_shared_mission_control_requires_external_endpoints(self): + self.assertIn('MC_DEFAULT_XGT_HOST', render({'xgt': {'enabled': False}}, fails=True)) + self.assertIn('externalUri', render({'mongodb': {'enabled': False}}, fails=True)) + objects = render({'xgt': {'enabled': False}, + 'backend': {'env': {'MC_DEFAULT_XGT_HOST': 'xgt-test-xgt'}, + 'oidc': {'xgtAllowedHosts': 'xgt-dev-xgt:4367,xgt-test-xgt:4367,xgt-prod-xgt:4367'}}}) + self.assertEqual({o['metadata']['labels']['app'] for o in objects + if o['kind'] == 'Deployment'}, {'frontend', 'backend', 'mongodb'}) + env = component(objects, 'Deployment', 'backend')['spec']['template']['spec']['containers'][0]['env'] + hosts = next(e['value'] for e in env if e['name'] == 'MC_XGT_ALLOWED_HOSTS') + self.assertIn('xgt-prod-xgt:4367', hosts) + + def test_invalid_hostnames_and_multiple_replicas_fail(self): + for hostname in ['BAD', 'host.example', '-host', 'host-', 'x' * 64]: + with self.subTest(hostname=hostname): + self.assertIn('hostname', render({'xgt': {'hostname': hostname}}, fails=True)) + self.assertIn('replicas > 1', render({'xgt': {'replicas': 2, 'hostname': 'fixed'}}, fails=True)) + + def test_explicit_claims_remain_supported(self): + objects = render({'missionControl': {'enabled': False}, + 'mongodb': {'enabled': False}, + 'xgt': {'hostname': 'licensed', 'persistence': { + 'data': {'existingClaim': 'existing-data'}, + 'log': {'existingClaim': 'existing-log'}}}}) + self.assertFalse(any(o['kind'] == 'PersistentVolumeClaim' for o in objects)) + pod = component(objects, 'Deployment', 'xgt')['spec']['template']['spec'] + self.assertEqual({v['persistentVolumeClaim']['claimName'] for v in pod['volumes'] + if 'persistentVolumeClaim' in v}, {'existing-data', 'existing-log'}) + + def test_documented_openshift_values_share_one_mission_control(self): + path = CHART.parents[1] / 'doc/openshift_test_server/values.yaml' + for release, hostname in [('rocketgraph', 'xgt-test-0'), + ('xgt-dev', 'xgt-dev-0'), ('xgt-prod', 'xgt-prod-0')]: + with self.subTest(release=release): + values = yaml.safe_load(path.read_text()) + if release != 'rocketgraph': + values['missionControl'] = {'enabled': False} + values['mongodb']['enabled'] = False + values['xgt']['hostname'] = hostname + objects = render(values, release) + deployments = [o for o in objects if o['kind'] == 'Deployment'] + self.assertEqual(len(deployments), 4 if release == 'rocketgraph' else 1) + pod = component(objects, 'Deployment', 'xgt')['spec']['template']['spec'] + self.assertEqual(pod['hostname'], hostname) + self.assertEqual(pod['containers'][0]['image'], + 'docker.io/rocketgraph/xgt:2.7.1-fips') + config = component(objects, 'ConfigMap', 'xgt') + self.assertEqual(json.loads(config['data']['xgtd.conf']) + ['security.oidc']['validation_mode'], 'openshift_userapi') + if release == 'rocketgraph': + env = component(objects, 'Deployment', 'backend')['spec']['template']['spec']['containers'][0]['env'] + hosts = next(e['value'] for e in env if e['name'] == 'MC_XGT_ALLOWED_HOSTS') + self.assertEqual(set(hosts.split(',')), { + 'rocketgraph-xgt:4367', 'xgt-dev-xgt:4367', 'xgt-prod-xgt:4367'}) + self.assertFalse(next(e['value'] for e in env if e['name'] == 'XGT_SERVER_CN')) + + +class CustomizationTests(unittest.TestCase): + def restricted(self, **xgt): + return {'missionControl': {'enabled': False}, 'mongodb': {'enabled': False}, + 'openshift': {'enabled': True, 'scc': 'restricted-v2'}, + 'xgt': xgt} + + def test_restricted_xgt_has_no_elevated_binding_and_uses_direct_startup(self): + values = yaml.safe_load((CHART / 'examples/xgt_openshift_restricted.yaml').read_text()) + objects = render(values) + self.assertFalse(any(o['kind'] == 'ClusterRoleBinding' for o in objects)) + self.assertEqual(sum(o['kind'] == 'ServiceAccount' for o in objects), 1) + pod = component(objects, 'Deployment', 'xgt')['spec']['template']['spec'] + container = pod['containers'][0] + self.assertEqual(pod['hostname'], 'xgt-test-0') + self.assertEqual(pod['securityContext']['seccompProfile']['type'], 'RuntimeDefault') + self.assertTrue(container['securityContext']['runAsNonRoot']) + self.assertFalse(container['securityContext']['allowPrivilegeEscalation']) + self.assertEqual(container['securityContext']['capabilities']['drop'], ['ALL']) + self.assertNotIn('runAsUser', container['securityContext']) + self.assertNotIn('fsGroup', pod['securityContext']) + self.assertEqual(container['command'], ['/opt/xgtd/bin/xgtd']) + self.assertIn('-Dsystem.health_port=4366', container['args']) + config = json.loads(component(objects, 'ConfigMap', 'xgt')['data']['xgtd.conf']) + self.assertEqual(config['license.location'], '/license/xgtd.lic') + self.assertEqual(config['security.oidc']['ca_cert'], '/etc/ssl/certs/oidc-ca.pem') + tls = next(v for v in pod['volumes'] if v['name'] == 'xgt-tls') + key = next(item for item in tls['secret']['items'] if item['key'] == 'server.key.pem') + self.assertEqual(key['mode'], 0o440) + + def test_existing_files_use_only_supplied_claim_and_no_generated_files(self): + values = yaml.safe_load((CHART / 'examples/xgt_existing_files.yaml').read_text()) + objects = render(values) + self.assertFalse(any(o['kind'] in ['ConfigMap', 'Secret', 'PersistentVolumeClaim', + 'ClusterRoleBinding'] for o in objects)) + pod = component(objects, 'Deployment', 'xgt')['spec']['template']['spec'] + self.assertEqual(pod['volumes'], [{'name': 'xgt-files', 'persistentVolumeClaim': + {'claimName': 'xgt-files'}}]) + mounts = pod['containers'][0]['volumeMounts'] + self.assertEqual({m['mountPath']: m['subPath'] for m in mounts}, + {'/'+d: 'xgt-prod/'+d for d in ['conf', 'license', 'data', 'log']}) + self.assertTrue(all(m['readOnly'] for m in mounts if m['mountPath'] in ['/conf','/license'])) + annotations = component(objects, 'Deployment', 'xgt')['spec']['template']['metadata'].get('annotations') or {} + self.assertNotIn('checksum/config', annotations) + values['xgt']['files']['subPath'] = '' + pod = component(render(values), 'Deployment', 'xgt')['spec']['template']['spec'] + self.assertEqual({m['subPath'] for m in pod['containers'][0]['volumeMounts']}, + {'conf', 'license', 'data', 'log'}) + + def test_existing_files_allow_separate_data_and_log_claims(self): + for separate in [('data',), ('log',), ('data', 'log')]: + for prefix in ['', 'xgt-prod']: + with self.subTest(separate=separate, prefix=prefix): + values = self.restricted( + files={'existingClaim': 'files', 'subPath': prefix}, + persistence={d: {'existingClaim': 'separate-' + d} for d in separate}) + objects = render(values) + self.assertFalse(any(o['kind'] in ['ConfigMap', 'Secret', 'PersistentVolumeClaim'] + for o in objects)) + pod = component(objects, 'Deployment', 'xgt')['spec']['template']['spec'] + volumes = {v['name']: v['persistentVolumeClaim']['claimName'] for v in pod['volumes']} + self.assertEqual(volumes, {'xgt-files': 'files', + **{'xgt-' + d: 'separate-' + d for d in separate}}) + mounts = pod['containers'][0]['volumeMounts'] + self.assertEqual(len(mounts), 4) + for mount in mounts: + directory = mount['mountPath'].lstrip('/') + if directory in separate: + self.assertEqual(mount['name'], 'xgt-' + directory) + self.assertNotIn('subPath', mount) + else: + self.assertEqual(mount['name'], 'xgt-files') + self.assertEqual(mount['subPath'], '/'.join(filter(None, [prefix, directory]))) + self.assertEqual(mount.get('readOnly', False), directory in ['conf', 'license']) + + def test_separate_data_example_keeps_logs_on_files_claim(self): + values = yaml.safe_load((CHART / 'examples/xgt_files_separate_data.yaml').read_text()) + pod = component(render(values), 'Deployment', 'xgt')['spec']['template']['spec'] + mounts = {m['mountPath']: m for m in pod['containers'][0]['volumeMounts']} + self.assertEqual(mounts['/data'], {'name': 'xgt-data', 'mountPath': '/data'}) + self.assertEqual(mounts['/log']['subPath'], 'xgt-prod/log') + self.assertEqual({v['persistentVolumeClaim']['claimName'] for v in pod['volumes']}, + {'xgt-files', 'xgt-data'}) + + def test_existing_configmap_and_external_license(self): + objects = render(self.restricted(config={'existingConfigMap': 'customer-config'})) + self.assertFalse(any(o['kind'] == 'ConfigMap' for o in objects)) + pod = component(objects, 'Deployment', 'xgt')['spec']['template']['spec'] + self.assertEqual(next(v for v in pod['volumes'] if v['name']=='xgt-config') + ['configMap']['name'], 'customer-config') + objects = render(self.restricted(extraConfig={'license.location': '6200@licenses.example.com'})) + cfg=json.loads(component(objects,'ConfigMap','xgt')['data']['xgtd.conf']) + self.assertEqual(cfg['license.location'], '6200@licenses.example.com') + + def test_native_startup_env_and_mount_overrides(self): + values = self.restricted(license={'existingSecret':'license'}, + command=['/custom/start'], args=['--site'], env=[{'name':'SITE','value':'customer'}], + extraVolumes=[{'name':'inputs','persistentVolumeClaim':{'claimName':'customer-input'}}], + extraVolumeMounts=[{'name':'inputs','mountPath':'/inputs','readOnly':True}]) + pod=component(render(values),'Deployment','xgt')['spec']['template']['spec'] + container=pod['containers'][0] + self.assertEqual(container['command'],['/custom/start']) + self.assertEqual(container['args'],['--site']) + self.assertEqual(container['env'],[{'name':'SITE','value':'customer'}]) + self.assertEqual(container['volumeMounts'][-1]['mountPath'],'/inputs') + self.assertEqual(pod['volumes'][-1]['persistentVolumeClaim']['claimName'],'customer-input') + + def test_restricted_rejects_unsupported_or_conflicting_settings(self): + cases=[(self.restricted(),'readable license'), + (self.restricted(license={'existingSecret':'license'},ldap={'enabled':True}),'SSSD'), + (self.restricted(license={'existingSecret':'license'},podSecurityContext={'fsGroup':1001}),'fsGroup'), + (self.restricted(license={'existingSecret':'license'},containerSecurityContext={'runAsUser':0}),'runAsUser'), + (self.restricted(license={'existingSecret':'license'},containerSecurityContext={'privileged':True}),'privileged'), + (self.restricted(license={'existingSecret':'license'},containerSecurityContext={'capabilities':{'add':['SYS_ADMIN']}}),'capabilities')] + values = self.restricted(licenseManager={'enabled': True}) + cases.append((values, 'License Manager')) + for values,message in cases: + with self.subTest(message=message):self.assertIn(message,render(values,fails=True)) + + def test_file_modes_reject_silently_ignored_settings_and_bad_mounts(self): + for override in [{'extraConfig':{'system.max_memory':'1'}}, + {'license':{'existingSecret':'unused'}}, + {'ssl':{'existingSecret':'unused'}}, + {'config':{'existingConfigMap':'unused'}}]: + values=self.restricted(files={'existingClaim':'files'},**override) + self.assertIn('xgt.files.existingClaim',render(values,fails=True)) + for path in ['../prod','/prod','prod/../dev','prod/']: + self.assertIn('subPath',render(self.restricted(files={'existingClaim':'files','subPath':path}),fails=True)) + self.assertIn('extraVolumes',render({'xgt':{'extraVolumes':[{'name':'xgt-data','emptyDir':{}}]}},fails=True)) + self.assertIn('extraVolumeMounts',render({'xgt':{'extraVolumeMounts':[{'name':'xgt-data','mountPath':'/data'}]}},fails=True)) + + def test_disabled_xgt_ignores_unused_file_and_mount_conflicts(self): + cases = [ + ({'files': {'existingClaim': 'files'}, 'extraConfig': {'system.max_memory': '1'}}, 'xgt.files'), + ({'files': {'existingClaim': 'files'}, 'license': {'existingSecret': 'license'}}, 'xgt.files'), + ({'files': {'existingClaim': 'files'}, 'ssl': {'existingSecret': 'tls'}}, 'xgt.files'), + ({'config': {'existingConfigMap': 'config'}, 'extraConfig': {'system.max_memory': '1'}}, 'existingConfigMap'), + ({'files': {'subPath': 'prod'}}, 'subPath'), + ({'extraVolumes': [{'name': 'xgt-data', 'emptyDir': {}}]}, 'extraVolumes'), + ({'extraVolumeMounts': [{'name': 'xgt-data', 'mountPath': '/data'}]}, 'extraVolumeMounts'), + ] + base = {'backend': {'env': {'MC_DEFAULT_XGT_HOST': 'external-xgt'}}} + expected = render(dict(base, xgt={'enabled': False})) + for override, message in cases: + with self.subTest(override=override): + self.assertIn(message, render(dict(base, xgt=dict(override, enabled=True)), fails=True)) + self.assertEqual(render(dict(base, xgt=dict(override, enabled=False))), expected) + + def test_explicit_oidc_ca_is_preserved_and_companion_has_ca(self): + values={'xgt':{'extraConfig':{'security.oidc':{'issuer':'https://issuer','ca_cert':'/custom/ca.pem'}}}, + 'backend':{'oidc':{'caCertExistingSecret':'cluster-ca'}}} + cfg=json.loads(component(render(values),'ConfigMap','xgt')['data']['xgtd.conf']) + self.assertEqual(cfg['security.oidc']['ca_cert'],'/custom/ca.pem') + companion=yaml.safe_load((CHART.parents[1]/'doc/openshift_fips_values.example.yaml').read_text()) + self.assertEqual(companion['xgt']['extraConfig']['security.oidc']['ca_cert'],'/etc/ssl/certs/oidc-ca.pem') + + def test_mongodb_warning_survives_disabled_mission_control(self): + # Render NOTES as ConfigMap data to keep this check offline on Helm 3 and 4. + with tempfile.TemporaryDirectory() as directory: + chart = Path(directory) / 'chart' + shutil.copytree(CHART, chart) + (chart / 'templates/notes-check.yaml').write_text( + 'apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: notes-check\n' + 'data:\n notes: {{ include (print $.Template.BasePath "/NOTES.txt") . | quote }}\n') + for enabled in [False, True]: + objects = render({'missionControl': {'enabled': enabled}}, chart=chart) + notes = next(o['data']['notes'] for o in objects + if o['metadata']['name'] == 'notes-check') + self.assertIn('MongoDB auth is DISABLED', notes) + self.assertIn('\n\nxGT Service:', notes) + if enabled: + self.assertIn('\n\nTo access the frontend:', notes) + else: + self.assertIn('MongoDB is still enabled', notes) + self.assertNotIn('To access the frontend:', notes) + + +class RestrictedStackTests(unittest.TestCase): + def values(self): + return {'openshift': {'enabled': True, 'scc': 'restricted-v2'}, + 'fips': {'enabled': True}, 'xgt': {'license': {'existingSecret': 'license'}}} + + def test_restricted_mission_control_requires_fips(self): + values = self.values() + del values['fips'] # Default image selection must fail early too. + self.assertIn('Mission Control requires fips.enabled=true', render(values, fails=True)) + values['fips'] = {'enabled': False} + self.assertIn('Mission Control requires fips.enabled=true', render(values, fails=True)) + values['missionControl'] = {'enabled': False} + self.assertTrue(render(values)) + values['missionControl']['enabled'] = True + values['openshift']['scc'] = 'anyuid' + self.assertTrue(render(values)) + values['openshift'] = {'enabled': False, 'scc': 'restricted-v2'} + self.assertTrue(render(values)) + + def test_full_stack_has_assigned_id_contexts_without_scc_grant(self): + objects = render(self.values()) + self.assertFalse(any(o['kind'] == 'ClusterRoleBinding' for o in objects)) + deployments = [o for o in objects if o['kind'] == 'Deployment'] + self.assertEqual(len(deployments), 4) + for deployment in deployments: + pod = deployment['spec']['template']['spec'] + self.assertEqual(pod['serviceAccountName'], 'test-rocketgraph') + self.assertEqual(pod['securityContext']['seccompProfile']['type'], 'RuntimeDefault') + for context in [pod['securityContext'], pod['containers'][0]['securityContext']]: + for field in ['runAsUser', 'runAsGroup', 'fsGroup', 'supplementalGroups']: + self.assertNotIn(field, context) + security = pod['containers'][0]['securityContext'] + self.assertTrue(security['runAsNonRoot']) + self.assertFalse(security['allowPrivilegeEscalation']) + self.assertEqual(security['capabilities']['drop'], ['ALL']) + self.assertEqual(security['seccompProfile']['type'], 'RuntimeDefault') + + def test_frontend_ports_mounts_and_tls_routing(self): + for tls in [{}, {'existingSecret': 'tls'}, + {'existingSecret': 'tls', 'mtls': True}, + {'publicCert': 'cert', 'privateKey': 'key'}]: + with self.subTest(tls=tls): + values = self.values() + values['frontend'] = {'tls': tls, 'service': {'httpPort': 9080, 'httpsPort': 9443}} + objects = render(values) + pod = component(objects, 'Deployment', 'frontend')['spec']['template']['spec'] + container = pod['containers'][0] + self.assertEqual([p['containerPort'] for p in container['ports']], [8080, 8443]) + self.assertEqual(container['readinessProbe']['httpGet']['port'], 'http') + self.assertEqual(container['command'], ['/bin/sh', '-ec']) + script = container['args'][0] + self.assertIn('/usr/local/bin/docker-entrypoint-ssl.sh', script) + self.assertIn('X-Forwarded-Port '+('9443' if tls else '9080')+';', script) + self.assertEqual(next(e['value'] for e in container['env'] if e['name']=='MC_SSL_PORT'), '9443') + mounts = {m['mountPath']: m for m in container['volumeMounts']} + for path in ['/etc/nginx/conf.d', '/run', '/var/log/nginx', '/var/lib/nginx/tmp']: + self.assertIn(path, mounts) + self.assertEqual(sum('emptyDir' in v for v in pod['volumes']), 4) + self.assertEqual('/etc/ssl/private/td.pem' in mounts, bool(tls)) + self.assertEqual('/etc/ssl/certs/ca-chain.pem' in mounts, bool(tls.get('mtls'))) + service = component(objects, 'Service', 'frontend') + self.assertEqual([(p['port'], p['targetPort']) for p in service['spec']['ports']], + [(9080, 8080), (9443, 8443)]) + policy = next(o for o in objects if o['kind']=='NetworkPolicy' and o['metadata']['name']=='test-frontend') + self.assertEqual([p['port'] for p in policy['spec']['ingress'][0]['ports']], [8080, 8443]) + + def test_frontend_startup_rewrites_inline_and_included_headers(self): + # Execute the rendered shell transformations, not a second implementation + # of the rewrite. Image setup/nginx launch are outside this unit test. + for layout in ['inline', 'include']: + for tls in [{}, {'existingSecret': 'tls'}, {'existingSecret': 'tls', 'mtls': True}]: + with self.subTest(layout=layout, tls=tls), tempfile.TemporaryDirectory() as directory: + values = self.values() + values['frontend'] = {'tls': tls, 'service': {'httpPort': 9080, 'httpsPort': 9443}} + container = component(render(values), 'Deployment', 'frontend')['spec']['template']['spec']['containers'][0] + nginx = Path(directory) / 'nginx' + conf_dir = nginx / 'conf.d' + conf_dir.mkdir(parents=True) + header = 'proxy_set_header X-Forwarded-Port $server_port;\nproxy_set_header Host $host;\n' + source = nginx / 'api_proxy_headers.inc' + if layout == 'include': + source.write_text(header) + source.chmod(0o444) + proxy = 'include /etc/nginx/api_proxy_headers.inc;\n' + else: + proxy = header + client_cert = '$ssl_client_escaped_cert' if tls.get('mtls') else '""' + config = ('server {\nlisten 80;\nlisten [::]:80;\n' + + ('listen 443 ssl;\nlisten [::]:443 ssl;\n' if tls else '') + + 'location /api {\n' + proxy + + f'proxy_set_header X-Client-Cert {client_cert};\n' + + '}\nlocation /docs {\n' + proxy + '}\n}\n') + active = conf_dir / 'nginx.conf' + active.write_text(config.replace('/etc/nginx', str(nginx))) + script = container['args'][0].replace('/etc/nginx', str(nginx)) + script = script.replace('/usr/local/bin/docker-entrypoint-ssl.sh', ':') + script = script.replace("exec nginx -g 'daemon off;'", ':') + result = subprocess.run(['/bin/sh', '-ec', script], capture_output=True, text=True) + self.assertEqual(result.returncode, 0, result.stderr) + rewritten = active.read_text() + self.assertIn('listen 8080;', rewritten) + self.assertIn('listen [::]:8080;', rewritten) + if tls: + self.assertIn('listen 8443 ssl;', rewritten) + self.assertIn('listen [::]:8443 ssl;', rewritten) + self.assertIn(f'proxy_set_header X-Client-Cert {client_cert};', rewritten) + if layout == 'include': + adjusted = conf_dir / 'api_proxy_headers.inc' + self.assertEqual(rewritten.count(f'include {adjusted};'), 2) + self.assertEqual(source.read_text(), header) + self.assertEqual(source.stat().st_mode & 0o777, 0o444) + rewritten = adjusted.read_text() + self.assertIn('X-Forwarded-Port '+('9443' if tls else '9080')+';', rewritten) + self.assertNotIn('X-Forwarded-Port $server_port;', rewritten) + self.assertIn('proxy_set_header Host $host;', rewritten) + self.assertEqual(list(conf_dir.glob('*.conf')), [active]) + + def test_mongodb_encryption_does_not_inject_fixed_ids(self): + values = self.values() + values['mongodb'] = {'encryption': {'enabled': True, 'existingSecret': 'encryption'}} + pod = component(render(values), 'Deployment', 'mongodb')['spec']['template']['spec'] + self.assertNotIn('fsGroup', pod['securityContext']) + init = pod['initContainers'][0] + self.assertNotIn('runAsUser', init['securityContext']) + self.assertTrue(init['securityContext']['runAsNonRoot']) + self.assertIn('chmod 400', init['command'][-1]) + values['openshift']['scc'] = 'anyuid' + pod = component(render(values), 'Deployment', 'mongodb')['spec']['template']['spec'] + self.assertEqual(pod['securityContext']['fsGroup'], 1001) + self.assertEqual(pod['initContainers'][0]['securityContext']['runAsUser'], 1001) + + def test_rejects_fixed_ids_and_elevated_contexts_on_each_component(self): + for name in ['frontend', 'backend', 'mongodb', 'xgt']: + for context in [{'runAsUser': 0}, {'runAsGroup': 1001}, {'fsGroup': 1001}, + {'supplementalGroups': [1001]}, {'privileged': True}, + {'capabilities': {'add': ['NET_BIND_SERVICE']}}]: + with self.subTest(component=name, context=context): + values = self.values() + values.setdefault(name, {})['containerSecurityContext'] = context + self.assertIn(name, render(values, fails=True)) + values = self.values() + values['missionControl'] = {'enabled': False} + values['frontend'] = {'containerSecurityContext': {'runAsUser': 0}} + self.assertTrue(render(values)) + + +if __name__ == '__main__': + unittest.main() diff --git a/charts/rocketgraph/values.schema.json b/charts/rocketgraph/values.schema.json index 58c67c0..3ef7a67 100644 --- a/charts/rocketgraph/values.schema.json +++ b/charts/rocketgraph/values.schema.json @@ -1185,7 +1185,7 @@ }, "existingClaim": { "type": "string", - "description": "Name of an existing PersistentVolumeClaim to use instead of creating one", + "description": "Existing PVC mounted at /data. Takes precedence over files.existingClaim for this directory.", "default": "" } } @@ -1207,7 +1207,7 @@ }, "existingClaim": { "type": "string", - "description": "Name of an existing PersistentVolumeClaim to use instead of creating one", + "description": "Existing PVC mounted at /log. Takes precedence over files.existingClaim for this directory.", "default": "" } } @@ -1263,7 +1263,7 @@ }, "data": { "type": "string", - "description": "Raw xGT license data", + "description": "Plain-text license file contents, not database data or base64. Ignored when existingSecret is provided.", "default": "" } } @@ -1339,6 +1339,11 @@ "type": "string", "description": "Newline-separated list of proxy CNs for PKIAuth (sets security.proxy_list)", "default": "" + }, + "existingConfigMap": { + "type": "string", + "default": "", + "description": "Use existing XGT configuration files instead of generating a ConfigMap." } } }, @@ -1566,6 +1571,65 @@ } } } + }, + "hostname": { + "type": "string", + "default": "", + "maxLength": 63, + "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?)?$", + "description": "Stable container OS hostname for hostname-bound licenses; leaves the Deployment and generated pod name unchanged." + }, + "files": { + "type": "object", + "additionalProperties": false, + "properties": { + "existingClaim": { + "type": "string", + "default": "", + "description": "Common PVC for conf, license, data and log; persistence.data/log.existingClaim overrides the corresponding mount." + }, + "subPath": { + "type": "string", + "default": "", + "pattern": "^([^./][^/]*)(/[^./][^/]*)*$|^$", + "description": "Relative parent directory on the common files PVC; does not apply to separate data/log claims. No dot or parent segments." + } + } + }, + "command": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "default": [] + }, + "env": { + "type": "array", + "items": { + "type": "object" + }, + "default": [] + }, + "extraVolumes": { + "type": "array", + "items": { + "type": "object" + }, + "default": [] + }, + "extraVolumeMounts": { + "type": "array", + "items": { + "type": "object" + }, + "default": [] } } }, @@ -1610,11 +1674,12 @@ }, "scc": { "type": "string", - "description": "SCC to grant: anyuid (required for fixed-UID images) or nonroot", + "description": "anyuid/nonroot grant that SCC; restricted-v2 configures non-root XGT, Mission Control and MongoDB without an elevated SCC binding. Mission Control requires fips.enabled=true with restricted-v2.", "default": "anyuid", "enum": [ "anyuid", - "nonroot" + "nonroot", + "restricted-v2" ] } } @@ -1689,6 +1754,17 @@ } } } + }, + "missionControl": { + "type": "object", + "additionalProperties": false, + "properties": { + "enabled": { + "type": "boolean", + "default": true, + "description": "Deploy the Mission Control frontend and backend. Disable MongoDB separately for an xGT-only release." + } + } } } } diff --git a/charts/rocketgraph/values.yaml b/charts/rocketgraph/values.yaml index 3537baf..b87ea15 100644 --- a/charts/rocketgraph/values.yaml +++ b/charts/rocketgraph/values.yaml @@ -1,5 +1,10 @@ imagePullSecrets: [] +# Disable the frontend/backend for a separate xGT-only release. +# Set mongodb.enabled=false too when no bundled database is needed. +missionControl: + enabled: true + frontend: image: repository: docker.io/rocketgraph/mission-control-frontend @@ -217,6 +222,21 @@ mongodb: xgt: enabled: true # Set to false to use an external xGT server + # Stable OS hostname for hostname-bound licenses; pod metadata.name still varies. + hostname: "" + # Use one pre-populated PVC for conf/, license/, data/, log/. + # When set, configuration/TLS/license files are managed on this PVC, not by Helm. + # Optional persistence.data/log.existingClaim overrides mount separate PVCs + # at /data and/or /log; all remaining directories stay on this files PVC. + files: + existingClaim: "" + subPath: "" # Optional parent directory, e.g. xgt-prod (relative, no trailing slash). + # Native Kubernetes startup/env/mount overrides. Lists replace supplied lists. + command: [] + args: [] + env: [] + extraVolumes: [] + extraVolumeMounts: [] image: repository: docker.io/rocketgraph/xgt tag: "2.7.1" # xGT versions independently of the chart's appVersion. @@ -264,11 +284,11 @@ xgt: data: size: 10Gi storageClassName: "" - existingClaim: "" + existingClaim: "" # Also overrides /data when files.existingClaim is set. log: size: 1Gi storageClassName: "" - existingClaim: "" + existingClaim: "" # Also overrides /log when files.existingClaim is set. ssl: enabled: false existingSecret: "" # Must have keys: server.cert.pem, server.key.pem @@ -278,7 +298,7 @@ xgt: caCert: "" # Inline CA cert PEM for validating client certs (ca-chain.cert.pem) license: existingSecret: "" # Must have key: xgtd.lic - data: "" # Plain-text license content + data: "" # License FILE TEXT, not database data or base64. Prefer existingSecret. # LDAP authentication via SSSD ldap: enabled: false @@ -292,6 +312,8 @@ xgt: sssdConfig: "" # raw sssd.conf content (overrides uri/baseDn/bindDn/etc.) # xGT config file overrides config: + # Must contain xgtd.conf, audit.xml, grouplabel.csv and label.csv. + existingConfigMap: "" grouplabelCsv: "" # Override grouplabel.csv contents labelCsv: "" # Override label.csv contents proxyList: "" # Newline-separated list of proxy CNs for PKIAuth (sets security.proxy_list) @@ -387,12 +409,13 @@ fips: tag: 8.0.23 openshift: - # Set to true when deploying on OpenShift — creates a ServiceAccount bound to the SCC below. + # Set to true on OpenShift — creates the release ServiceAccount. enabled: false - # SCC granted to the release ServiceAccount. - # anyuid — required when any image has a fixed non-root UID (e.g. Percona MongoDB uid 1001). - # nonroot — sufficient when all images declare a non-root USER but without a fixed UID; - # pair with containerSecurityContext.runAsNonRoot: true on each component. + # anyuid / nonroot: grant that SCC to the release ServiceAccount. + # restricted-v2: non-root XGT/Mission Control/MongoDB profile; no elevated SCC grant. + # Mission Control requires fips.enabled=true with restricted-v2. + # OpenShift assigns UID/fsGroup. Frontend uses writable runtime dirs and ports 8080/8443. + # Fixed non-root UIDs can use nonroot if permitted by cluster policy. scc: anyuid networkPolicy: diff --git a/doc/oidc_configuration.md b/doc/oidc_configuration.md index 448b8da..56736b6 100644 --- a/doc/oidc_configuration.md +++ b/doc/oidc_configuration.md @@ -1,47 +1,80 @@ -# OIDC Authentication Configuration +# OIDC and OpenShift OAuth2 Authentication > **Experimental:** OIDC authentication support is experimental and subject to > change. -This guide explains how to configure Mission Control to authenticate users via -an external OpenID Connect (OIDC) identity provider such as Keycloak or -OpenShift. +This guide covers OpenID Connect (OIDC) providers such as Keycloak and the +built-in OpenShift OAuth2 server. Both use the same Rocketgraph authentication +interfaces, but their token validation and identity lookup differ. + +| Provider | Login and identity handling | +| --- | --- | +| Keycloak | OIDC provider; in this guide, XGT validates signed JWT access tokens and reads their username/group claims. | +| OpenShift's built-in OAuth server | OAuth2 authorization-code login; XGT presents the access token to the OpenShift User API to validate it and retrieve the user's identity and groups. This integration does not use OIDC ID tokens or a standard OIDC UserInfo endpoint. | + +For OpenShift, keep the existing names `OidcAuth`, `security.oidc`, +`backend.oidc`, `MC_OIDC_*` and `/api/login/oidc/callback`. They are the API, +configuration and endpoint names for the shared implementation; do not rename +them to `OAuthAuth`, `security.oauth` or similar. Here, “OpenShift OAuth2” refers +specifically to the built-in OAuth server and `openshift_userapi` validation. > **Applies to all deployments.** The `MC_OIDC_*` variables below are set in -> `.env` for Docker Compose and Podman installs, and under `backend.env.*` (or the -> typed `backend.oidc.*` values) for Kubernetes and OpenShift — see +> `.env` for Docker Compose and Podman installs, and through the typed +> `backend.oidc.*` values for Kubernetes and OpenShift. Set `XGT_AUTH_TYPES` +> through `backend.env.XGT_AUTH_TYPES` — see > [OIDC Authentication](../charts/rocketgraph/README.md#oidc-authentication) in the > Helm chart documentation for the chart-side values and Secret wiring. ## Overview -When OIDC is enabled, Mission Control performs the OAuth 2.0 authorization code -flow on behalf of the user. After the user logs in at the identity provider, -Mission Control receives an access token and forwards it to the xGT server, -which validates the token and maps it to a user identity. +With `OidcAuth` enabled, Mission Control performs the OAuth2 authorization-code +flow on behalf of the user. The browser returns to its backend with a temporary +authorization code. The backend exchanges that code for an access token, using +the registered client ID and client secret for the confidential clients in +these examples. It then presents the access token to XGT. + +For OpenShift, the responsibilities are: -Mission Control can discover the OIDC issuer and client ID automatically from -the xGT server. The redirect URI is derived server-side from the incoming -request hostname and the configured `MC_PORT`/`MC_SSL_PORT` values, so in most -cases no OIDC-specific configuration is required beyond setting -`XGT_AUTH_TYPES`. +```text +Browser → OpenShift login (LDAP) → authorization code → Mission Control +Mission Control + client secret → OpenShift token endpoint → access token +Mission Control + access token → XGT → OpenShift User API → identity + groups +XGT group-to-label mappings → permissions on XGT data +``` + +The client secret authenticates the application obtaining a token. XGT's +`openshift_userapi` mode only validates an already-issued token and therefore +does not need that secret. A Python client using the same secret-backed +OAuthClient for browser login performs its own code exchange and needs the +secret too. A client presenting an existing service-account token with +`xgt.BearerTokenAuth` does not perform that exchange. + +Mission Control discovers the issuer, client ID, and advertised scopes from xGT when the issuer or client ID is unset. Discovery does not supply client secrets or private CA certificates. The callback is derived from the public frontend origin unless overridden. + +| Setting | When to Supply It | +| --- | --- | +| `XGT_AUTH_TYPES="['OidcAuth']"` | Enable browser login for OIDC or OpenShift OAuth2. | +| Client secret | Required for the secret-backed OpenShift OAuthClient and confidential Keycloak Mission Control client used in this guide. | +| CA mount and TLS verification path | Required when the provider's CA is not already trusted. | +| Issuer / client ID / scopes | Override discovery when needed, such as a separate Mission Control client ID. If both issuer and client ID are explicit, supply provider-specific scopes explicitly too. | +| Frontend URL | Override when proxy headers produce the wrong public origin, including an HTTP URL behind HTTPS termination. | +| Redirect URI | Override only when the callback must differ from `/api/login/oidc/callback`. | +| Allowed origins | Optional restriction on accepted frontend origins. | ## Quick Start -To enable OIDC login in Mission Control, set `XGT_AUTH_TYPES` in your `.env` +To enable either browser-login integration, set `XGT_AUTH_TYPES` in your `.env` file: ```dotenv XGT_AUTH_TYPES="['OidcAuth']" ``` -If the xGT server is configured with `security.oidc.issuer` and -`security.oidc.client_id`, Mission Control will discover those values -automatically. +Configure `security.oidc` on xGT, register the callback below, and supply the client secret and CA settings required by the provider. See the [Keycloak](#keycloak-example) and [OpenShift](#openshift-example) examples. ## Redirect URI -**Before Mission Control can complete an OIDC login, the redirect URI must be +**Before Mission Control can complete browser login, the redirect URI must be registered with the identity provider.** The redirect URI is derived server-side as `{origin}/api/login/oidc/callback`, @@ -57,9 +90,7 @@ https://mc.example.com/api/login/oidc/callback - **Keycloak:** add this URI to the client's *Valid redirect URIs* list. - **OpenShift:** add this URI to the OAuthClient's `redirectURIs` list. -If the derived URI does not match your deployment (e.g. an additional proxy -layer changes the public hostname), set `MC_OIDC_REDIRECT_URI` explicitly to -match what is registered with the IdP. +If a proxy changes the apparent scheme or hostname, set `MC_OIDC_FRONTEND_URL` to the public HTTPS origin. This fixes both the post-login destination and the derived callback. A separate `MC_OIDC_REDIRECT_URI` is only needed to override that callback. For HTTPS terminated upstream, also set `MC_EXTERNAL_TLS=true` in Compose or `frontend.tls.external: true` in Helm so session cookies are marked Secure. ## Environment Variables @@ -68,13 +99,13 @@ match what is registered with the IdP. | `MC_OIDC_ISSUER` | | OIDC issuer URL (e.g. `https://keycloak.example.com/realms/xgt`). If empty, discovered from the xGT server. | | `MC_OIDC_CLIENT_ID` | | OAuth2 client ID registered with the IdP. If empty, discovered from the xGT server. | | `MC_OIDC_CLIENT_SECRET` | | Client secret for confidential clients. Leave empty for public clients. | -| `MC_OIDC_SCOPES` | | Space-separated OAuth2 scopes to request. Default: `openid profile email`. | -| `MC_OIDC_FRONTEND_URL` | | Override the frontend base URL used for post-login redirects. Derived server-side from the request hostname and `MC_PORT`/`MC_SSL_PORT` by default. Only needed when those values do not produce the correct public URL. | +| `MC_OIDC_SCOPES` | | Optional space-separated override. During xGT discovery, uses the advertised scopes if unset, such as `user:info` for OpenShift. When bypassing discovery, set the provider's required scopes explicitly. | +| `MC_OIDC_FRONTEND_URL` | | Override the public frontend origin used for post-login redirects and the derived callback. Otherwise derived from request/proxy headers and `MC_PORT`/`MC_SSL_PORT`. | | `MC_OIDC_REDIRECT_URI` | | Override the redirect URI sent to the IdP. Derived server-side from the request hostname and `MC_PORT`/`MC_SSL_PORT` by default. Only needed when those values do not produce the correct public URL. | | `MC_OIDC_ALLOWED_ORIGINS` | | *(Optional defense-in-depth)* Comma-separated list of permitted frontend origins. Patterns may include `*` wildcards (e.g. `https://*.apps.cluster.example.com`). When set, OIDC login attempts from any non-matching origin are rejected. Leave unset to allow any origin. | | `MC_XGT_ALLOWED_HOSTS` | | Comma-separated allowlist of permitted xGT servers as `host:port` pairs. Patterns may include `*` wildcards (e.g. `xgt-*.xgt.myns.svc.cluster.local:4367`). When set, connections to any non-matching host are rejected. Leave unset to allow any host. Recommended when the xGT host is user-supplied. | | `MC_OIDC_TLS_VERIFY` | | TLS verification for OIDC HTTP calls. `true` (default) uses the system CA bundle. `false` disables verification. A file path uses that file as the CA bundle. | -| `MC_OIDC_CA_CERT` | Y | Path to a CA bundle PEM file on the host to trust for OIDC HTTPS calls. Mounted into the container automatically. | +| `MC_OIDC_CA_CERT` | Y | Compose host path for the CA bundle mounted at `/etc/ssl/certs/oidc-ca.pem`. Also set `MC_OIDC_TLS_VERIFY` to the container path. In Helm, use `backend.oidc.caCertExistingSecret` and `backend.oidc.tlsVerify`. | ## Security Allowlists @@ -87,7 +118,7 @@ OpenShift deployments where hostnames are dynamically assigned. Restricts which xGT servers Mission Control may connect to, preventing SSRF attacks where a crafted login request points the backend at an unintended internal host. Values are `host:port` pairs. When unset, any host is -accepted. +accepted. The Helm chart defaults this allowlist to its internal xGT service when `xgt.enabled=true`; set it explicitly for an external xGT endpoint. ```dotenv # Fixed deployment @@ -122,33 +153,69 @@ Mission Control at the CA bundle using `MC_OIDC_CA_CERT`: ```dotenv MC_OIDC_CA_CERT=/path/to/ca-bundle.pem +MC_OIDC_TLS_VERIFY=/etc/ssl/certs/oidc-ca.pem ``` -The file is volume-mapped into the container. If the CA is already trusted by -the system, no additional configuration is needed. +The first value selects the host file to mount; the second tells the backend to verify HTTPS using that file inside the container. If the CA is already trusted by the system, omit both. For Helm, use a Secret with key `oidc-ca.pem` as shown in the [chart's CA example](../charts/rocketgraph/README.md#ca-certificates). -To disable TLS verification entirely (not recommended for production): +## Keycloak Example -```dotenv -MC_OIDC_TLS_VERIFY=false -``` +Use a separate confidential client, such as `mission-control`, with **Client authentication** and **Standard flow** enabled. Register `https://mc.example.com/api/login/oidc/callback`. Add Group Membership and Audience mappers to its access tokens, using the groups claim and audience configured on xGT. -## Keycloak Example +Mission Control 2.7.0 does not send a PKCE challenge; do not require PKCE for this confidential client. Keep the separate Python browser client public with PKCE `S256` required and callback `http://127.0.0.1:8765/callback`. ```dotenv XGT_AUTH_TYPES="['OidcAuth']" +MC_OIDC_CLIENT_ID=mission-control +MC_OIDC_CLIENT_SECRET= ``` -If `MC_OIDC_ISSUER` and `MC_OIDC_CLIENT_ID` are left empty, Mission Control -discovers them from the xGT server. See the xGT sysadmin guide for full -Keycloak setup instructions. +Leave the issuer and scopes unset to discover them from xGT. Supply private-CA settings if needed and `MC_OIDC_FRONTEND_URL=https://mc.example.com` if the derived origin is wrong. In Helm, use `backend.oidc.clientId` and `existingSecret` instead of embedding the client secret in values. See the [Helm example](../charts/rocketgraph/README.md#keycloak). ## OpenShift Example +This example uses **OpenShift OAuth2**, through the existing `OidcAuth` interface. +An OpenShift `OAuthClient` is a cluster-wide application registration. Its +`metadata.name` is the client ID, and its `secret` authenticates the application +at the token endpoint. It is separate from the namespaced Kubernetes Secret +referenced by `backend.oidc.existingSecret`, which stores that same secret value +under `MC_OIDC_CLIENT_SECRET` for Mission Control to read. + +Three settings that can otherwise be confused: + +| Setting | Meaning | +| --- | --- | +| `scopeRestrictions: [{literals: [user:info]}]` on the OAuthClient | Allows this application to request the `user:info` scope. | +| `security.oidc.scopes: user:info` on XGT | Advertises which scope browser-login clients should request. Scope permission alone does not request it. | +| `grantMethod: prompt` on the OAuthClient | Asks the user to approve access when consent has not already been granted. It does not select the OAuth grant type or force password entry. | + +Mission Control uses the authorization-code grant; the Python example selects +it with `xgt.OidcAuth(flow='auth_code', ...)`. Both request `user:info` in this +setup. XGT's own group-to-label mappings determine data permissions, so users +with the same OAuth scope can have different XGT privileges. + +For a complete installation with LDAP login, group synchronization, FIPS images and automation tokens, follow the [OpenShift test-server guide](openshift_test_server/README.md). + ```dotenv XGT_AUTH_TYPES="['OidcAuth']" -MC_OIDC_SCOPES=user:info -MC_OIDC_TLS_VERIFY=false +MC_OIDC_CLIENT_SECRET= +MC_OIDC_CA_CERT=/path/to/openshift-ca.pem +MC_OIDC_TLS_VERIFY=/etc/ssl/certs/oidc-ca.pem ``` -See the xGT sysadmin guide for full OpenShift setup instructions. +Configure xGT with `validation_mode: openshift_userapi` and `scopes: user:info`. Leave Mission Control's issuer, client ID, and scopes unset to discover them from xGT. The OAuthClient needs `user:info` in `scopeRestrictions` and the HTTPS Mission Control callback in `redirectURIs`. For edge Routes, use external TLS and override the frontend origin if necessary as described above. See the [Helm example](../charts/rocketgraph/README.md#openshift-oauth). + +## LDAP Groups and Automated Accounts + +LDAP validates user passwords through the provider. Group synchronization and xGT authorization need separate configuration: + +| Provider | Group Path to xGT | Automated Login | +| --- | --- | --- | +| OpenShift | Synchronize selected LDAP groups with `oc adm groups sync`; xGT reads membership from the OpenShift User API. | Provision a Kubernetes service-account token and use `xgt.BearerTokenAuth`. | +| Keycloak | Configure LDAP federation and an LDAP group mapper; add a Group Membership protocol mapper to each client issuing xGT access tokens. | Use a separate confidential client with service accounts enabled and `xgt.OidcCredentialsAuth`. | + +For either provider, map group names in `grouplabel.csv` to labels declared in `label.csv`. Set up recurring synchronization or rerun it after LDAP changes, then reconnect. Assign automation memberships deliberately; they do not inherit LDAP users' groups. See [xGT authentication setup](https://docs.rocketgraph.com/sysadmin_guide/user_authentication.html) for provider configuration, label mappings, and token provisioning. + +## Verify the Setup + +Test an LDAP user mapped to `xgtadmin` (Alice) and a regular user (Bob) through Mission Control. Check the returned identity and permissions, run `RETURN 1 AS ok`, and verify that Bob cannot access admin-only data. Confirm an incorrect password is rejected. For Python and automated connections, check `conn.userid`, `conn.is_admin`, and `conn.get_user_labels()`, then run `conn.run_job("RETURN 1 AS ok").get_data()` and expect `[[1]]`. diff --git a/doc/openshift_fips_deployment.md b/doc/openshift_fips_deployment.md new file mode 100644 index 0000000..d47e522 --- /dev/null +++ b/doc/openshift_fips_deployment.md @@ -0,0 +1,192 @@ +# XGT on OpenShift: LDAP Login and FIPS Deployment + +Deployment planning guide + +For a concrete first installation with commands and checkpoints, use the separate [test-server walkthrough](openshift_test_server/README.md). + +**Proposed approach:** run XGT and Mission Control on OpenShift, use the existing LDAP directory through OpenShift browser login, and map OpenShift groups to XGT permissions. Automated applications use service-account tokens. The identity administrators manage LDAP integration; the XGT administrator manages application permissions. + +```text +Human → Mission Control / Python browser login → OpenShift OAuth → LDAP + ↓ token +Client → XGT → OpenShift User API → username + groups → XGT labels + +LDAP groups → scheduled OpenShift group sync → OpenShift Group objects +Automated job → service-account token → XGT → same User API validation +``` + +This integration is **OpenShift OAuth2 authentication**. The API remains `xgt.OidcAuth`, and configuration names remain `security.oidc`, `backend.oidc` and `MC_OIDC_*`. Mission Control or the Python browser client exchanges an authorization code for an access token. XGT validates that token through the OpenShift User API (`openshift_userapi`) to retrieve identity and groups; it does not use OIDC ID tokens or a standard UserInfo endpoint. The client secret belongs to the application obtaining the token, not XGT's token validation. See the [XGT authentication reference](https://docs.rocketgraph.com/sysadmin_guide/user_authentication.html#openshift). + +## 1. Agree on the Deployment Inputs + +**Owners: OpenShift administrator, identity administrator, XGT administrator, security/PKI team.** + +| Input | Decision needed | +| --- | --- | +| Cluster | OpenShift version, existing FIPS configuration, namespace, capacity and storage class | +| Identity | LDAP endpoint, trusted CA, read-only bind account, user/group search schema and nested-group rules | +| Permissions | Directory groups for XGT administrators and regular users; separate automation permissions | +| Endpoints | Mission Control HTTPS URL, OpenShift OAuth URL, and reachable XGT endpoint for clients/jobs | +| License | License file and stable licensed hostname, with one XGT replica initially | +| Operations | Owners of group sync, certificate/secret rotation, token renewal and backups | + +Example names throughout: application namespace `xgt`, automation namespace `xgt-jobs`, Helm release `rocketgraph`, OAuthClient `xgt-client`, and Mission Control `https://mc.apps.example.com`. Replace them consistently. + +Example licensed hostnames are `xgt-prod-0`, `xgt-test-0`, and `xgt-dev-0`; obtain a license covering the names used in your installation. Chart 0.4.0 adds `xgt.hostname` to set the container's licensed hostname while retaining Helm's Deployment. A release name alone does not set this hostname. Use a separate Helm release per independent XGT server, each with its own hostname, settings and storage. Additional releases can disable Mission Control and MongoDB and share the first release's Mission Control. The [test-server guide](openshift_test_server/README.md#optional-add-separate-dev-and-prod-xgt-releases) includes commands. + +## 2. Establish the FIPS and TLS Requirements First + +**Owners: OpenShift and security/PKI teams, with Rocketgraph support.** + +Confirm that the target cluster was installed for FIPS operation. OpenShift documents FIPS as an installation-time choice; it cannot simply be enabled on an already deployed cluster. Follow the instructions for the customer's exact OpenShift version. [OpenShift FIPS guidance](https://docs.redhat.com/en/documentation/openshift_container_platform/4.20/html/installation_overview/installing-fips) + +Select these image families through `fips.enabled: true`: + +| Component | Images used in our compatibility test | +| --- | --- | +| XGT | `rocketgraph/xgt:2.7.1-fips` | +| Mission Control frontend | `rocketgraph/mission-control-frontend:2.7.0-fips` | +| Mission Control backend | `rocketgraph/mission-control-backend:2.7.0-fips` | +| MongoDB | `percona/percona-server-mongodb:8.0.23` | + +Keep base XGT/Mission Control tags unsuffixed in Helm values; the chart appends `-fips`. The example values use the chart's default Percona image through `fips.enabled: true`, with no MongoDB image override. Pin an approved chart version and review its rendered image versions before installing or upgrading. The table records what we tested, not a claim that those are the latest approved production versions. [Chart FIPS settings](https://github.com/Rocketgraphai/rocketgraph/tree/main/charts/rocketgraph#fips-mode) + +**FIPS images are one part of the deployment.** Confirm the validated cryptographic modules, supported operating environment and runtime configuration for each component with the vendors/security team. Include browser/OAuth HTTPS, verified LDAP TLS, XGT TLS, and MongoDB TLS. With both `fips.enabled` and `mongodb.tls.enabled`, this chart supplies MongoDB's `--tlsFIPSMode`; verify it starts successfully with the required cryptographic module active. [Percona FIPS guidance](https://docs.percona.com/percona-server-for-mongodb/8.0/fips.html) + +Decide whether Route-to-frontend and frontend-to-backend traffic must also be encrypted. An edge Route terminates HTTPS at the router; neither it nor the FIPS image switch secures every internal hop. Include storage encryption in the design if required by the organization's policy. + +**What our lab established:** login, groups, labels, queries and automation worked with the selected images. The lab host was not in FIPS mode, so this was not an end-to-end FIPS validation. + +## 3. Connect LDAP to OpenShift and Schedule Group Sync + +**Owners: identity and OpenShift administrators.** + +1. Reuse the existing OpenShift LDAP identity provider if one is already configured. Otherwise configure the LDAP URL, read-only bind credentials, user attributes and trusted CA; test browser login first. +2. Choose the LDAP groups to import, for example `xgt-admins` and `xgt-users`. +3. Prepare an `LDAPSyncConfig` matching the actual directory schema and a whitelist containing the selected group identifiers expected by that configuration. Ensure synchronized usernames match the OpenShift login identities. +4. Preview and then apply the synchronization: + +```sh +oc adm groups sync --sync-config=ldap_sync_config.yaml --whitelist=ldap_groups.txt +oc adm groups sync --sync-config=ldap_sync_config.yaml --whitelist=ldap_groups.txt --confirm +oc get groups xgt-admins xgt-users -o yaml +``` + +5. Assign an owner and schedule for recurring synchronization, with failure monitoring and a process for removed memberships/groups. Test both additions and removals. + +For the CronJob, service account, permissions and setup commands, use the [group-sync walkthrough](openshift_test_server/README.md#4-preview-and-apply-group-sync). It starts suspended and can be enabled after a successful test run. + +**LDAP password validation and LDAP group synchronization are separate.** Successful login does not mean groups have been imported. XGT reads the groups exposed by OpenShift; it does not perform this sync. [OpenShift group synchronization](https://docs.redhat.com/en/documentation/openshift_container_platform/4.20/html/authentication_and_authorization/ldap-syncing) + +## 4. Register the Browser Login Client + +**Owner: OpenShift administrator.** + +Create an OAuthClient with a generated secret, the `user:info` scope restriction, and exact callback URLs: + +```yaml +apiVersion: oauth.openshift.io/v1 +kind: OAuthClient +metadata: + name: xgt-client +secret: REPLACE_WITH_GENERATED_SECRET +grantMethod: prompt +scopeRestrictions: + - literals: ["user:info"] +redirectURIs: + - http://127.0.0.1:8765/callback + - https://mc.apps.example.com/api/login/oidc/callback +``` + +The localhost callback is for Python browser login and must be reachable by the user's browser on the client machine. The HTTPS callback is for Mission Control. Provide the client secret securely to Mission Control and authorized Python clients; server discovery does not distribute credentials. Keep the completed manifest out of source control. [OpenShift OAuth client registration](https://docs.redhat.com/en/documentation/openshift_container_platform/4.20/html/authentication_and_authorization/configuring-oauth-clients) + +## 5. Prepare the License, Configuration, Certificates and Storage + +**Owners: XGT administrator and security/PKI team.** + +Create the application namespace and these Secrets there before deployment. Names match the [companion Helm values](openshift_fips_values.example.yaml): + +| Secret | Required keys / purpose | +| --- | --- | +| `xgt-license` | `xgtd.lic`: license matching the chosen hostname | +| `xgt-oauth-client` | `MC_OIDC_CLIENT_SECRET`: the OAuthClient secret | +| `oidc-ca` | `oidc-ca.pem`: CA bundle trusting the OpenShift OAuth and User API endpoints | +| `xgt-ssl` | `server.cert.pem`, `server.key.pem`: XGT server certificate and key | +| `backend-tls` | `xgt-server.pem`: CA used by Mission Control to verify XGT | +| `mongodb-tls` | `server.pem` (certificate plus private key), `ca.pem` | +| `mongodb-auth` | `mongodb-root-password`: generated database password; bundled chart user is `rocketgraph` | + +Use certificates whose identities/SANs cover the actual service names used by clients, including `rocketgraph-xgt` and `rocketgraph-mongodb` for this example release. Supply the Mission Control Route certificate through the platform's approved process. Client workstations also need the appropriate CA trust. + +The chart mounts the license at `/license/xgtd.lic`, XGT configuration at `/conf/xgtd.conf`, label files at `/conf/grouplabel.csv` and `/conf/label.csv`, and the OAuth/API CA bundle at `/etc/ssl/certs/oidc-ca.pem`. Provision persistent storage for XGT data/logs and MongoDB; agree on resource sizing and backups. + +Have the platform administrator review the chart's service-account/SCC permissions. The full-stack example uses chart 0.4.0's [restricted-v2 profile](../charts/rocketgraph/README.md#full-stack-with-openshift-restricted-v2), which creates no elevated SCC binding and lets OpenShift assign UIDs/groups. XGT starts directly with mounted configuration/license, and Mission Control's frontend uses writable nginx directories and container ports 8080/8443. Backend and MongoDB use their existing entrypoints. FIPS image selection and SCC permissions are separate requirements. If the platform requires centralized file storage, see the [existing-files PVC example](../charts/rocketgraph/README.md#bring-your-own-xgt-files). + +## 6. Configure and Deploy XGT and Mission Control + +**Owner: XGT administrator, with OpenShift administrator support.** + +Start with [openshift_fips_values.example.yaml](openshift_fips_values.example.yaml), replace the example endpoints/names, and add site-specific storage, resource sizing and workload configuration. Its essential settings are: + +- **XGT:** `validation_mode: openshift_userapi`, the cluster User API URL, OAuth issuer/client ID, `username_claim: metadata.name`, `groups_claim: groups`, and `scopes: user:info`. +- **Authorization:** map `xgt-admins → xgtadmin`, `xgt-users → data-users`, and the dedicated automation namespace's service-account group to `automation`. Declare each label. Apply data-access labels to the relevant XGT namespaces/frames; assigning a label alone does not define which data requires it. +- **Mission Control:** enable `OidcAuth`, supply its OAuth secret, configure CA trust and XGT TLS. It discovers issuer, client ID and scopes from XGT. `frontendUrl` is only needed when the proxy-derived public URL is wrong; `redirectUri` is another optional override, not an additional required setting. +- **FIPS/TLS:** select the FIPS images, enable XGT TLS and MongoDB `requireTLS`, and use the agreed Route/internal-traffic design. + +Render the chart for review before installing through the approved Helm/GitOps workflow: + +```sh +helm template rocketgraph ./charts/rocketgraph \ + --namespace xgt -f doc/openshift_fips_values.example.yaml > rendered.yaml +``` + +The companion values are a review template, not a complete production manifest. Set `xgt.hostname` to the licensed name and add the HTTPS Route; verify the rendered images, mounts, TLS settings and SCC grant, then deploy. Confirm healthy pods/PVCs, DNS, certificate validation and network access to LDAP, OAuth, the User API, XGT and MongoDB as appropriate for each component. + +For an existing MongoDB deployment, back it up and pause writers before a supported migration to Percona. Existing volume ownership may need a storage-specific migration to the new workload identity. The restricted profile uses namespace-assigned IDs, not a fixed UID 1001; verify access before switching an existing database. Fresh PVCs were tested, which does not establish compatibility with previously populated storage. Handle this as a controlled database migration, not a blanket permission change. + +## 7. Provision Automated Access and Token Renewal + +**Owners: job owner and OpenShift administrator.** + +Create a service account in the dedicated automation namespace and issue an expiring token for the initial test: + +```sh +oc create namespace xgt-jobs +oc -n xgt-jobs create serviceaccount xgt-automation +umask 077 +oc -n xgt-jobs create token xgt-automation --duration=1h > xgt.token +``` + +The requested duration is subject to the cluster's token policy. Jobs use `xgt.BearerTokenAuth(token)` over an approved TLS connection to XGT. They do not need an interactive browser, LDAP user password, or OpenShift administrator credentials. For jobs in Kubernetes, arrange a projected service-account token with an audience accepted by this validation path; the application must reread refreshed token contents when creating new connections. External jobs need an authorized token issuer/renewal process and secure token delivery. + +The example mapping `system:serviceaccounts:xgt-jobs → automation` applies to **every service account in that namespace**. Restrict who can create workloads/service accounts there and grant only the intended XGT permissions. Do not map the broad service-account group to `xgtadmin` by default. XGT labels and OpenShift RBAC are separate; add cluster permissions only for operations the job actually needs. + +If the environment explicitly requires a manually created long-lived service-account token Secret, agree on secure storage, rotation and revocation ownership. It is an alternative to automatic short-lived token renewal, not a prerequisite for automation. Recheck XGT session behavior during token revocation/expiry tests. + +## 8. Demonstrate and Accept the Installation + +**Owners: application tester, identity administrator and security team.** + +| Test | Expected outcome | +| --- | --- | +| Alice in `xgt-admins` and `xgt-users` logs in through Mission Control | Browser visits OpenShift; XGT reports Alice with `xgtadmin` and `data-users` | +| Bob only in `xgt-users` logs in | `data-users`, no XGT admin access; admin-only data access denied | +| Wrong LDAP password | Authentication rejected | +| Python `xgt.OidcAuth` login | Browser flow completes and connects to the intended TLS-protected XGT endpoint | +| Service-account job using `xgt.BearerTokenAuth` | Expected service-account identity and `automation` label; intended query succeeds | +| LDAP membership removed and group sync rerun | New XGT session loses that access; document behavior for existing sessions | +| Token/certificate renewal | Connections continue using refreshed material; expired/invalid credentials fail as expected | +| FIPS verification on target cluster | Platform and application crypto evidence accepted by security team, including MongoDB FIPS/TLS startup | + +For each successful XGT connection, check `conn.userid`, `conn.is_admin`, `conn.get_user_labels()` and `conn.run_job("RETURN 1 AS ok").get_data()`; the query should return `[[1]]`. Record the owners and schedules for group sync, credential renewal, backups and upgrades before handoff. + +## Alternative Authentication Methods + +| Mechanism | When it fits | Additional responsibility | +| --- | --- | --- | +| **OpenShift OAuth backed by LDAP — proposed** | OpenShift already owns login and group management | LDAP group sync and OAuthClient registration | +| Keycloak OIDC backed by LDAP | Organization already uses Keycloak or needs a separate identity provider | LDAP federation/group claims, browser and service clients; Keycloak's own FIPS deployment must be validated separately | +| Host-managed SSSD with sockets mounted into XGT | Existing administrator-managed SSSD integration on controlled hosts | Host/socket permissions, PAM/NSS integration and pod scheduling dependencies | +| SSSD inside XGT | Simple, dedicated direct LDAP/password setup | SSSD configuration, CA/bind credentials and daemon lifecycle; does not reproduce a complex enterprise SSSD policy automatically | + +The deployment decisions are the identity path, responsible administrators, licensed hostname, FIPS/TLS requirements, group mappings, and automation renewal mechanism. Once those are agreed, the deployment inputs above can be filled in and reviewed. diff --git a/doc/openshift_fips_values.example.yaml b/doc/openshift_fips_values.example.yaml new file mode 100644 index 0000000..cf060a7 --- /dev/null +++ b/doc/openshift_fips_values.example.yaml @@ -0,0 +1,76 @@ +# Companion to openshift_fips_deployment.md. +# Requires chart 0.4.0 or later. +# Review template, not a complete production deployment: supply Secrets, +# licensed workload hostname, storage/sizing, Route, and approved TLS topology. +# Versions match the lab image test; approve exact versions/digests for rollout. +openshift: + enabled: true + scc: restricted-v2 +fips: + enabled: true + +xgt: + hostname: xgt-test-0 + image: + tag: 2.7.1 + replicas: 1 + license: + existingSecret: xgt-license + ssl: + enabled: true + existingSecret: xgt-ssl + config: + grouplabelCsv: | + group,label + xgtd,xgtadmin + xgt-admins,xgtadmin + xgt-users,data-users + system:serviceaccounts:xgt-jobs,automation + labelCsv: | + label + xgtadmin + data-users + automation + extraConfig: + security.oidc: + issuer: https://oauth-openshift.apps.example.com + client_id: xgt-client + validation_mode: openshift_userapi + openshift_user_api_uri: https://kubernetes.default.svc/apis/user.openshift.io/v1/users/~ + username_claim: metadata.name + groups_claim: groups + scopes: user:info + ca_cert: /etc/ssl/certs/oidc-ca.pem + +frontend: + image: + tag: 2.7.0 + tls: + # Example uses HTTPS terminated at an OpenShift edge Route. + # Review internal HTTP hops against the deployment's security requirements. + external: true + +backend: + image: + tag: 2.7.0 + env: + XGT_AUTH_TYPES: "['OidcAuth']" + MC_DEFAULT_XGT_PORT: '4367' + tls: + existingSecret: backend-tls + oidc: + existingSecret: xgt-oauth-client + caCertExistingSecret: oidc-ca + tlsVerify: /etc/ssl/certs/oidc-ca.pem + # Use this override if proxy-derived public URLs are wrong. + frontendUrl: https://mc.apps.example.com + # issuer, clientId, and scopes are discovered from XGT. + +mongodb: + auth: + enabled: true + existingSecret: mongodb-auth + tls: + enabled: true + mode: requireTLS + existingSecret: mongodb-tls diff --git a/doc/openshift_test_server/.gitignore b/doc/openshift_test_server/.gitignore new file mode 100644 index 0000000..45b8cb9 --- /dev/null +++ b/doc/openshift_test_server/.gitignore @@ -0,0 +1,7 @@ +.private/ +.venv/ +__pycache__/ +rendered.yaml +values.site.yaml +ldap-sync.site.yaml +site.yaml diff --git a/doc/openshift_test_server/README.md b/doc/openshift_test_server/README.md new file mode 100644 index 0000000..4eee14b --- /dev/null +++ b/doc/openshift_test_server/README.md @@ -0,0 +1,388 @@ +# Test Server: OpenShift, LDAP Login and FIPS Images + +Follow these steps for a fresh test installation on an existing OpenShift cluster and LDAP directory. Edit the supplied YAML, create Secrets with `oc`, and install with Helm and `oc apply`. Python is used only to demonstrate XGT login. + +**Authentication terminology:** this walkthrough uses **OpenShift OAuth2**. +The Python API and Mission Control still call the shared authentication option +`OidcAuth`, and settings remain under `security.oidc`, `backend.oidc` and +`MC_OIDC_*`. OpenShift returns an OAuth access token; XGT validates it through +the OpenShift User API to obtain identity and groups. This flow does not use +OIDC ID tokens or a standard OIDC UserInfo endpoint. + +**Deployment:** Helm manages XGT, Mission Control and MongoDB. Set `xgt.hostname: xgt-test-0` for the licensed container hostname. The Kubernetes pod name remains generated. Optional separate releases provide dev and prod XGT servers with their own configuration and storage, sharing Mission Control. + +**Requires chart 0.4.0 or later; the commands below use the chart in this repository.** Rendering has been checked, and an isolated XGT 2.7.1 FIPS-image release passed license validation, OpenShift token login and a query. Its fixed hostname and a file on its data volume survived pod replacement. The complete installation below has not been deployed to a fresh cluster. The [deployment planning guide](../openshift_fips_deployment.md) covers the architecture and FIPS verification responsibilities. + +The full chart was also tested under `restricted-v2` with namespace-assigned UIDs, Mission Control HTTPS/mTLS, MongoDB TLS/mTLS and encryption at rest, and XGT TLS/token authentication. This used fresh PVCs and temporary test certificates; existing-volume migration, optional backend plugin installation and end-to-end FIPS compliance require separate validation. + +## Files to Edit + +| File | What to change | +| --- | --- | +| [namespaces.yaml](namespaces.yaml) | Fixed test namespaces and automation account; normally leave unchanged | +| [ldap_provider.yaml](ldap_provider.yaml) | LDAP URL, bind DN and user attributes; a fragment to append to cluster OAuth settings | +| [ldap_sync_config.yaml](ldap_sync_config.yaml), [ldap_groups.txt](ldap_groups.txt) | Directory searches, membership attributes and the two selected group DNs | +| [ldap_sync.yaml](ldap_sync.yaml) | Approved OpenShift CLI image; contains sync RBAC and a suspended CronJob | +| [oauth_client.yaml](oauth_client.yaml) | Mission Control callback; fill the secret only in a private copy | +| [values.yaml](values.yaml) | XGT hostname, OAuth issuer, group-to-label mappings, images, resources/storage, Mission Control URL and MongoDB settings | +| [route.yaml](route.yaml) | Public Mission Control hostname | +| [login.py](login.py) | Ready-to-run browser/token login and data-permission demonstration | + +Example names are `xgt-demo` (application namespace), `xgt-demo-jobs` (automation namespace), `xgt-demo-ldap-sync` (sync namespace), and `rocketgraph` (Helm release). Keep these names for the walkthrough. All commands run from this directory in **Bash**, with `oc` already logged in as an authorized administrator. Use an approved repository revision containing chart 0.4.0 or later. + +## 1. Confirm the Prerequisites + +```sh +cd doc/openshift_test_server +umask 077 +mkdir -p .private +oc whoami +oc whoami --show-server +oc get nodes +oc get storageclass +``` + +Get a license for `xgt-test-0`, directory access details, and two LDAP test users: + +| User | LDAP memberships | Expected XGT access | +| --- | --- | --- | +| Alice | Admin and users groups | `xgtadmin`, `data-users` | +| Bob | Users group only | `data-users`, no admin access | + +The sync configuration maps the two selected LDAP DNs to OpenShift names `xgt-admins` and `xgt-users`. Agree ownership of these cluster-wide groups before changing them. The supplied schema expects group member DNs and user `uid` attributes; adapt it if the directory differs. + +The example requests about 3 GiB of application memory and 16 GiB of persistent storage, plus cluster overhead. If no suitable default storage class exists, set `xgt.persistence.data.storageClassName`, `xgt.persistence.log.storageClassName` and `mongodb.persistence.storageClassName` in `values.yaml`. + +For a FIPS deployment, the platform must already be prepared for FIPS, and the security team must verify each application's approved crypto modules/runtime. Image tags alone do not establish compliance. OpenShift FIPS is an installation-time choice. [OpenShift FIPS guidance](https://docs.redhat.com/en/documentation/openshift_container_platform/4.20/html/installation_overview/installing-fips) + +**Expected:** cluster, storage, license, LDAP accounts, image versions and FIPS requirements are agreed. + +## 2. Supply Files and Create the Namespaces + +Copy the license and directory inputs from their secure locations: + +```sh +cp /secure/path/xgtd.lic .private/xgtd.lic +cp /secure/path/ldap-ca.crt .private/ldap-ca.crt +cp /secure/path/ldap-bind-password .private/ldap-bind-password +oc apply -f namespaces.yaml +``` + +The password file contains only the read-only LDAP bind password, without a trailing newline. For the usual cluster-managed OAuth/API certificates, collect the trust bundle using `oc`: + +```sh +oc -n openshift-config-managed get configmap default-ingress-cert \ + -o jsonpath='{range .data.*}{.}{"\n"}{end}' > .private/oauth-ca.pem +oc -n openshift-config-managed get configmap kube-root-ca.crt \ + -o jsonpath='{range .data.*}{.}{"\n"}{end}' > .private/api-ca.pem +cat .private/oauth-ca.pem .private/api-ca.pem > .private/oidc-ca.pem +``` + +Check these commands succeeded. If custom endpoint certificates use other CAs, obtain the correct bundle from the platform administrator instead. + +For the FIPS target, obtain approved certificates and keys from PKI: + +```sh +cp /secure/path/xgt-cert.pem .private/xgt-cert.pem +cp /secure/path/xgt-key.pem .private/xgt-key.pem +cp /secure/path/xgt-ca.pem .private/xgt-ca.pem +cp /secure/path/mongodb-cert.pem .private/mongodb-cert.pem +cp /secure/path/mongodb-key.pem .private/mongodb-key.pem +cp /secure/path/mongodb-ca.pem .private/mongodb-ca.pem +``` + +XGT's certificate must cover `rocketgraph-xgt`; MongoDB's must cover `rocketgraph-mongodb`. Include namespace-qualified service DNS names where used. The Route hostname must be covered by the router certificate, or its own certificate must be supplied. + +For a disposable functional test, the optional `bash make_test_certificates.sh` command produces the six server certificate/key files instead of the PKI copy commands. It is not evidence of a FIPS-approved key-generation process. Do not run it over existing certificates. + +**Expected:** private files exist; test namespaces are created. Keep `.private/` out of source control. + +## 3. Configure OpenShift LDAP Login + +Skip this step if the existing OpenShift LDAP provider already authenticates the test users. Otherwise create its inputs: + +```sh +oc -n openshift-config create secret generic xgt-demo-ldap-bind \ + --from-file=bindPassword=.private/ldap-bind-password +oc -n openshift-config create configmap xgt-demo-ldap-ca \ + --from-file=ca.crt=.private/ldap-ca.crt +oc get oauth cluster -o yaml > .private/oauth-before.yaml +oc edit oauth cluster +``` + +In the editor, append the edited entry from `ldap_provider.yaml` under `spec.identityProviders`. **Preserve the existing entries.** This file is a provider fragment, not a standalone object for `oc apply`. + +```sh +oc get clusteroperator authentication +``` + +Wait for the operator to be healthy, then authenticate as Alice and Bob through the OpenShift console in separate browser sessions. They need not have permission to inspect cluster resources. + +**Expected:** both LDAP passwords authenticate before XGT is installed. Note their resulting OpenShift usernames; group sync must produce the same names. + +## 4. Preview and Apply Group Sync + +Edit `ldap_sync_config.yaml`, `ldap_groups.txt` and the CLI image in `ldap_sync.yaml`. Keep the CronJob suspended. Create its inputs and RBAC: + +```sh +oc -n xgt-demo-ldap-sync create secret generic ldap-bind \ + --from-file=bindPassword=.private/ldap-bind-password +oc -n xgt-demo-ldap-sync create configmap ldap-ca \ + --from-file=ca.crt=.private/ldap-ca.crt +oc -n xgt-demo-ldap-sync create configmap ldap-sync-config \ + --from-file=sync.yaml=ldap_sync_config.yaml --from-file=groups.txt=ldap_groups.txt \ + --dry-run=client -o yaml | oc apply -f - +oc apply -f ldap_sync.yaml +``` + +Use the standard CLI to make a preview Job from the CronJob: + +```sh +oc -n xgt-demo-ldap-sync create job --from=cronjob/xgt-demo-ldap-sync \ + xgt-sync-preview --dry-run=client -o yaml > .private/preview-job.yaml +``` + +Open `.private/preview-job.yaml` and **remove the `- --confirm` argument**. Then run the preview: + +```sh +oc apply -f .private/preview-job.yaml +oc -n xgt-demo-ldap-sync wait --for=condition=complete job/xgt-sync-preview --timeout=330s +oc -n xgt-demo-ldap-sync logs job/xgt-sync-preview +``` + +After checking the proposed users and groups, create a confirmed Job from the unchanged CronJob: + +```sh +oc -n xgt-demo-ldap-sync create job --from=cronjob/xgt-demo-ldap-sync xgt-sync-first +oc -n xgt-demo-ldap-sync wait --for=condition=complete job/xgt-sync-first --timeout=330s +oc -n xgt-demo-ldap-sync logs job/xgt-sync-first +oc get groups xgt-admins xgt-users -o yaml +``` + +**Expected:** Alice is in both groups and Bob only in `xgt-users`. This job runs inside the cluster, so the workstation needs no direct LDAP connection. The sync service account's group permissions are cluster-wide; the whitelist restricts the command, not RBAC. Protect its workload and configuration. [OpenShift group-sync procedure](https://docs.redhat.com/en/documentation/openshift_container_platform/4.20/html/authentication_and_authorization/ldap-syncing) + +## 5. Register the OAuth Client + +An OpenShift `OAuthClient` is a cluster-wide **application registration**. It +identifies the application requesting tokens and records its client secret, +permitted scopes and callback URLs. In this example, Mission Control and the +Python browser-login client share that registration. XGT receives the resulting +bearer token and validates it through the OpenShift User API. + +These similarly named items have different roles: + +| Item | Role | +| --- | --- | +| `OAuthClient` named `xgt-demo-client` | The application registration in OpenShift; its name is the client ID | +| XGT setting `client_id: xgt-demo-client` | Advertises that registration's ID to clients starting browser login | +| `Secret` named `xgt-oauth-client` | A separate, namespaced Kubernetes Secret that supplies the client secret to Mission Control | +| `backend.oidc.existingSecret: xgt-oauth-client` | References that Kubernetes Secret, not the OAuthClient resource | + +The secret value in the OAuthClient must match the value stored under +`MC_OIDC_CLIENT_SECRET` in the Kubernetes Secret created in step 6. XGT's +`openshift_userapi` token validation does not require this client secret. +This registration does not configure LDAP, synchronize groups, or assign XGT +permissions; those are separate steps. + +The login grant is `authorization_code` (`flow='auth_code'` in `login.py`). +`grantMethod: prompt` controls consent when access has not already been granted; +it does not select the grant type or force password entry. The OAuthClient +allows `user:info` via `scopeRestrictions`; XGT advertises it via +`xgt.extraConfig.security.oidc.scopes`, and the login client requests it. That +scope permits user-information lookup; XGT group-to-label mappings determine +which data the user can access. + +Mission Control exchanges the returned authorization code for an access token +using the client secret. The Python browser client does the same independently. +XGT receives the token after this exchange, so its `openshift_userapi` validation +needs the token and CA trust, not the application's client secret. Automated +clients using an existing service-account token skip the code exchange. + +Generate the client secret once and make a private copy of the manifest: + +```sh +openssl rand -hex 32 | tr -d '\n' > .private/oauth-client-secret +cp oauth_client.yaml .private/oauth_client.yaml +``` + +In an editor, copy the secret from `.private/oauth-client-secret` into the private manifest's `secret` field. Set the correct Mission Control callback URL. Keep the local Python callback unchanged. Then apply: + +```sh +oc apply -f .private/oauth_client.yaml +oc get oauthclient xgt-demo-client -o jsonpath='{.redirectURIs}' +``` + +**Expected:** `user:info` is allowed; the callbacks are `http://127.0.0.1:8765/callback` and the Mission Control URL plus `/api/login/oidc/callback`. Do not regenerate the secret on routine reruns. [OAuthClient registration](https://docs.redhat.com/en/documentation/openshift_container_platform/4.20/html/authentication_and_authorization/configuring-oauth-clients) + +## 6. Create Application Secrets + +Generate the MongoDB password once for the fresh database, then create the seven Secrets: + +```sh +openssl rand -hex 32 | tr -d '\n' > .private/mongodb-password +cat .private/mongodb-cert.pem .private/mongodb-key.pem > .private/mongodb-server.pem +oc -n xgt-demo create secret generic xgt-license --from-file=xgtd.lic=.private/xgtd.lic +oc -n xgt-demo create secret generic xgt-oauth-client \ + --from-file=MC_OIDC_CLIENT_SECRET=.private/oauth-client-secret +oc -n xgt-demo create secret generic oidc-ca --from-file=oidc-ca.pem=.private/oidc-ca.pem +oc -n xgt-demo create secret generic xgt-ssl \ + --from-file=server.cert.pem=.private/xgt-cert.pem \ + --from-file=server.key.pem=.private/xgt-key.pem +oc -n xgt-demo create secret generic backend-tls --from-file=xgt-server.pem=.private/xgt-ca.pem +oc -n xgt-demo create secret generic mongodb-tls \ + --from-file=server.pem=.private/mongodb-server.pem --from-file=ca.pem=.private/mongodb-ca.pem +oc -n xgt-demo create secret generic mongodb-auth \ + --from-file=mongodb-root-password=.private/mongodb-password +oc -n xgt-demo get secrets +``` + +**Expected:** all seven Secrets exist. These are first-install commands; on reruns reuse them. Do not regenerate the password for an initialized database. Store the private inputs securely for renewal and recovery. + +## 7. Edit the Application Configuration and Deploy + +In `values.yaml`, set the actual OAuth issuer under `xgt.extraConfig.security.oidc` and set `backend.oidc.frontendUrl` to the public Mission Control URL. This URL must match `route.yaml` and the callback registered in step 5. + +`xgt.config` contains the group-to-label mappings; `xgt.extraConfig` holds server settings. Keep `xgt.enabled: true` and `xgt.hostname: xgt-test-0`. Helm's `fips.enabled: true` selects the XGT/Mission Control FIPS images and the chart's default Percona MongoDB image; no MongoDB image override is needed. Base XGT/Mission Control tags stay unsuffixed. Use an approved chart revision and review the rendered images before installing or upgrading. + +```sh +helm template rocketgraph ../../charts/rocketgraph \ + -n xgt-demo -f values.yaml > .private/helm-rendered.yaml +``` + +Review the rendered resources: this example selects `restricted-v2`, creates no elevated SCC grant and leaves UID/GID assignment to OpenShift. The frontend Service retains ports 80/443 and targets container ports 8080/8443. Then install: + +```sh +helm upgrade --install rocketgraph ../../charts/rocketgraph \ + -n xgt-demo -f values.yaml --wait --timeout=10m +oc -n xgt-demo get pods,pvc +oc -n xgt-demo exec deployment/rocketgraph-xgt -- cat /proc/sys/kernel/hostname +``` + +**Expected:** four ready application pods, bound PVCs, and hostname `xgt-test-0`. XGT uses TLS; MongoDB uses authentication, required TLS and `--tlsFIPSMode`. Check logs and the actual crypto configuration for FIPS acceptance; do not disable verification to pass the test. + +All application workloads are managed with Helm. After editing XGT settings or mappings in `values.yaml`, rerun the same `helm upgrade --install` command. The chart's configuration checksum triggers a new XGT pod. External Secret changes may require a rollout restart. + +### Optional: Add Separate Dev and Prod XGT Releases + +Use one Helm release per XGT server. These are independent servers, not replicas or an HA cluster. Each receives separate configuration, Services and data/log PVCs. The commands below reuse the test settings; add a per-environment values file when settings differ. + +First ensure the license covers `xgt-dev-0` and `xgt-prod-0`. XGT TLS certificates must cover each release's Service name. The optional test certificate script includes all three names. For separate production certificates, create separate Secrets and override `xgt.ssl.existingSecret`; include their issuing CAs in Mission Control's `backend-tls` trust bundle. Override `xgt.license.existingSecret` if licenses are separate. + +```sh +helm upgrade --install xgt-dev ../../charts/rocketgraph \ + -n xgt-demo -f values.yaml \ + --set missionControl.enabled=false --set mongodb.enabled=false \ + --set xgt.hostname=xgt-dev-0 --wait --timeout=10m + +helm upgrade --install xgt-prod ../../charts/rocketgraph \ + -n xgt-demo -f values.yaml \ + --set missionControl.enabled=false --set mongodb.enabled=false \ + --set xgt.hostname=xgt-prod-0 --wait --timeout=10m +``` + +| Helm release | Licensed container hostname | XGT endpoint | Includes Mission Control/MongoDB | +| --- | --- | --- | --- | +| `rocketgraph` | `xgt-test-0` | `rocketgraph-xgt:4367` | Yes | +| `xgt-dev` | `xgt-dev-0` | `xgt-dev-xgt:4367` | No | +| `xgt-prod` | `xgt-prod-0` | `xgt-prod-xgt:4367` | No | + +`xgt.enabled` stays `true` for all three. The shared Mission Control's `backend.oidc.xgtAllowedHosts` already lists these endpoints. Leave `backend.env.XGT_SERVER_CN` unset so TLS checks each selected endpoint's certificate identity. XGT-only releases still use `backend.oidc.caCertExistingSecret` to mount the OAuth/API CA bundle. + +Keep the release-specific settings on subsequent upgrades, preferably in version-controlled values files. Each additional XGT requests 2 GiB of memory and 11 GiB of storage with this example. Uninstalling a release also deletes the PVCs created by this chart; arrange backups and volume retention before storing data you need to keep. + +## 8. Publish Mission Control + +```sh +oc apply -f route.yaml +oc -n xgt-demo get route mission-control +``` + +The supplied edge Route encrypts browser-to-router traffic. Router-to-frontend and frontend-to-backend traffic is HTTP in this example. If those hops must be encrypted, use the approved internal TLS design before proceeding. FIPS image selection does not change those connections. + +Open the HTTPS URL and sign in through OpenShift, selecting the LDAP provider. If the Mission Control login form is shown, choose `OidcAuth` (the existing option name for OpenShift OAuth2). If asked for an XGT endpoint, use `rocketgraph-xgt:4367`. Test Alice and Bob separately. + +**Expected:** Alice is an XGT administrator; Bob has `data-users` without `xgtadmin`. Mission Control discovers the issuer/client ID/scopes from XGT; the OAuth secret and CA are supplied separately. `frontendUrl` is the public Mission Control URL override, not the OpenShift login URL. + +## 9. Test Python Login and Data Permissions + +Python is needed only for this client demonstration: + +```sh +python3 -m venv .venv +. .venv/bin/activate +python -m pip install -r requirements.txt +``` + +In a second terminal, open an administrator-authorized tunnel: + +```sh +oc -n xgt-demo port-forward service/rocketgraph-xgt 14367:4367 --address=127.0.0.1 +``` + +From the browser's workstation, with the virtual environment active: + +```sh +python login.py --demo create +python login.py --demo read +``` + +Choose Alice to create the sample table. Repeat the read command as Alice and Bob, signing out of the OpenShift browser session between identities. The browser must reach the local callback on port 8765. + +**Expected:** Alice reads `[[42]]` from the admin-only table; Bob gets an expected denial. The script also prints identity, labels, administrator status and `[[1]]` from a basic query. It verifies XGT TLS through the tunnel. + +To test an optional dev/prod server instead, tunnel its Service and pass its certificate name, for example `python login.py --server-name xgt-dev-xgt`. Each server has its own demo data. + +## 10. Test an Automated Account + +```sh +oc -n xgt-demo-jobs create token xgt-automation --duration=1h > .private/xgt.token +python login.py --token-file .private/xgt.token +python login.py --token-file .private/xgt.token --demo read +``` + +**Expected:** identity `system:serviceaccount:xgt-demo-jobs:xgt-automation`, label `automation`, successful basic query, no admin access and denied admin-only data access. No browser or LDAP password is used. Actual token lifetime follows cluster policy. + +This demonstration uses the administrator's tunnel. Real jobs need an approved network path and token renewal. The chart's default XGT NetworkPolicy permits connections to the XGT port from any source; review that policy against your client-access requirements. The namespace-wide automation label applies to every service account in `xgt-demo-jobs`. + +## 11. Show Membership Changes and Turn On Scheduled Sync + +Have the LDAP administrator add Bob to the admin group using the directory UI or the supplied [add-membership LDIF](bob_add_admin.ldif.example). For the LDIF approach, edit the actual DNs and use an authorized LDAP account: + +```sh +LDAPTLS_CACERT="$PWD/.private/ldap-ca.crt" LDAPTLS_REQCERT=demand \ + ldapmodify -x -H ldaps://YOUR_LDAP_HOST:636 -D 'YOUR_LDAP_ADMIN_DN' -W \ + -f bob_add_admin.ldif.example +oc -n xgt-demo-ldap-sync create job --from=cronjob/xgt-demo-ldap-sync xgt-sync-add +oc -n xgt-demo-ldap-sync wait --for=condition=complete job/xgt-sync-add --timeout=330s +python login.py --demo read +``` + +Choose Bob: a fresh session should now have admin access. Restore his original membership using [bob_remove_admin.ldif.example](bob_remove_admin.ldif.example) with the same `ldapmodify` command, run another sync Job named `xgt-sync-remove`, and verify that a fresh Bob session is denied. Use a new Job name for each repeat. Also test rejection of an incorrect password. + +To enable the 15-minute schedule, change `spec.suspend` to `false` in `ldap_sync.yaml`: + +```sh +oc apply -f ldap_sync.yaml +oc -n xgt-demo-ldap-sync get cronjobs,jobs +``` + +For new groups, update `ldap_groups.txt`, the sync name mappings and XGT label mappings, then recreate/update the sync ConfigMap with the step 4 `--dry-run=client` command and upgrade each affected Helm release with its values. Removing a whitelist entry does not delete the existing OpenShift Group. Assign ownership for group removal, alerts, credential renewal and existing-session revocation behavior. + +Log in as Alice to remove the demo data, then close the tunnel: + +```sh +python login.py --demo cleanup +``` + +## Troubleshooting + +```sh +oc -n xgt-demo get events --sort-by=.lastTimestamp +oc -n xgt-demo describe pods -l app=xgt,app.kubernetes.io/instance=rocketgraph +oc -n xgt-demo logs deployment/rocketgraph-xgt --tail=50 +oc -n xgt-demo logs deployment/rocketgraph-backend --tail=100 +oc -n xgt-demo logs deployment/rocketgraph-mongodb --tail=100 +oc -n xgt-demo-ldap-sync get jobs,pods +``` + +Check LDAP login before group sync, group membership before XGT labels, and certificate trust/network access before OAuth callbacks. This is a fresh installation, not a database migration. The earlier lab validated image compatibility and authentication, not an end-to-end FIPS environment. diff --git a/doc/openshift_test_server/bob_add_admin.ldif.example b/doc/openshift_test_server/bob_add_admin.ldif.example new file mode 100644 index 0000000..8458ecc --- /dev/null +++ b/doc/openshift_test_server/bob_add_admin.ldif.example @@ -0,0 +1,5 @@ +# LDAP administrator: replace both DNs and the membership attribute if needed. +dn: cn=xgt-admins,ou=groups,dc=example,dc=com +changetype: modify +add: member +member: uid=bob,ou=people,dc=example,dc=com diff --git a/doc/openshift_test_server/bob_remove_admin.ldif.example b/doc/openshift_test_server/bob_remove_admin.ldif.example new file mode 100644 index 0000000..b80231a --- /dev/null +++ b/doc/openshift_test_server/bob_remove_admin.ldif.example @@ -0,0 +1,5 @@ +# Removes only Bob's membership, not the group or its other members. +dn: cn=xgt-admins,ou=groups,dc=example,dc=com +changetype: modify +delete: member +member: uid=bob,ou=people,dc=example,dc=com diff --git a/doc/openshift_test_server/ldap_groups.txt b/doc/openshift_test_server/ldap_groups.txt new file mode 100644 index 0000000..a7700f1 --- /dev/null +++ b/doc/openshift_test_server/ldap_groups.txt @@ -0,0 +1,2 @@ +cn=xgt-admins,ou=groups,dc=example,dc=com +cn=xgt-users,ou=groups,dc=example,dc=com diff --git a/doc/openshift_test_server/ldap_provider.yaml b/doc/openshift_test_server/ldap_provider.yaml new file mode 100644 index 0000000..83fdd25 --- /dev/null +++ b/doc/openshift_test_server/ldap_provider.yaml @@ -0,0 +1,18 @@ +# Fragment: append this entry under spec.identityProviders in `oc edit oauth cluster`. +# This is not a standalone object for `oc apply`. Preserve existing providers. +- name: xgt-demo-ldap + mappingMethod: claim + type: LDAP + ldap: + url: ldaps://ldap.example.com:636/ou=people,dc=example,dc=com?uid?sub?(objectClass=inetOrgPerson) + bindDN: cn=xgt-bind,dc=example,dc=com + bindPassword: + name: xgt-demo-ldap-bind + ca: + name: xgt-demo-ldap-ca + insecure: false + attributes: + id: [dn] + preferredUsername: [uid] + name: [cn] + email: [mail] diff --git a/doc/openshift_test_server/ldap_sync.yaml b/doc/openshift_test_server/ldap_sync.yaml new file mode 100644 index 0000000..e4ae746 --- /dev/null +++ b/doc/openshift_test_server/ldap_sync.yaml @@ -0,0 +1,104 @@ +# Edit the oc image before applying. Starts suspended. +apiVersion: v1 +kind: ServiceAccount +metadata: + name: xgt-demo-ldap-sync + namespace: xgt-demo-ldap-sync +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: xgt-demo-ldap-sync +rules: +- apiGroups: + - user.openshift.io + resources: + - groups + verbs: + - get + - list + - create + - update +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: xgt-demo-ldap-sync +subjects: +- kind: ServiceAccount + name: xgt-demo-ldap-sync + namespace: xgt-demo-ldap-sync +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: xgt-demo-ldap-sync +--- +apiVersion: batch/v1 +kind: CronJob +metadata: + name: xgt-demo-ldap-sync + namespace: xgt-demo-ldap-sync +spec: + schedule: '*/15 * * * *' + suspend: true + concurrencyPolicy: Forbid + startingDeadlineSeconds: 300 + successfulJobsHistoryLimit: 2 + failedJobsHistoryLimit: 3 + jobTemplate: + spec: + backoffLimit: 1 + activeDeadlineSeconds: 300 + template: + spec: + serviceAccountName: xgt-demo-ldap-sync + restartPolicy: Never + securityContext: + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + containers: + - name: sync + image: registry.redhat.io/openshift4/ose-cli:REPLACE_WITH_APPROVED_TAG + command: + - oc + args: + - --cache-dir=/tmp/oc-cache + - adm + - groups + - sync + - --sync-config=/etc/ldap-sync/sync.yaml + - --whitelist=/etc/ldap-sync/groups.txt + - --confirm + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + resources: + requests: + cpu: 50m + memory: 128Mi + limits: + cpu: '1' + memory: 512Mi + volumeMounts: + - name: config + mountPath: /etc/ldap-sync + readOnly: true + - name: bind + mountPath: /etc/ldap-bind + readOnly: true + - name: ca + mountPath: /etc/ldap-ca + readOnly: true + volumes: + - name: config + configMap: + name: ldap-sync-config + - name: bind + secret: + secretName: ldap-bind + - name: ca + configMap: + name: ldap-ca diff --git a/doc/openshift_test_server/ldap_sync_config.yaml b/doc/openshift_test_server/ldap_sync_config.yaml new file mode 100644 index 0000000..9f77705 --- /dev/null +++ b/doc/openshift_test_server/ldap_sync_config.yaml @@ -0,0 +1,31 @@ +apiVersion: v1 +kind: LDAPSyncConfig +url: ldaps://ldap.example.com:636 +insecure: false +ca: /etc/ldap-ca/ca.crt +bindDN: cn=xgt-bind,dc=example,dc=com +bindPassword: + file: /etc/ldap-bind/bindPassword +# Use these same DNs in ldap_groups.txt. Keep the resulting OpenShift names +# aligned with xgt.config.grouplabelCsv in values.yaml. +groupUIDNameMapping: + cn=xgt-admins,ou=groups,dc=example,dc=com: xgt-admins + cn=xgt-users,ou=groups,dc=example,dc=com: xgt-users +rfc2307: + groupsQuery: + baseDN: ou=groups,dc=example,dc=com + scope: sub + derefAliases: never + pageSize: 0 + groupUIDAttribute: dn + groupNameAttributes: [cn] + groupMembershipAttributes: [member] + usersQuery: + baseDN: ou=people,dc=example,dc=com + scope: sub + derefAliases: never + pageSize: 0 + userUIDAttribute: dn + userNameAttributes: [uid] + tolerateMemberNotFoundErrors: false + tolerateMemberOutOfScopeErrors: false diff --git a/doc/openshift_test_server/login.py b/doc/openshift_test_server/login.py new file mode 100644 index 0000000..ed6a6b4 --- /dev/null +++ b/doc/openshift_test_server/login.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python3 +"""Browser or service-account login over the test server's localhost tunnel.""" +import argparse +from pathlib import Path + +import xgt + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument('--token-file', type=Path) + parser.add_argument('--port', type=int, default=14367) + parser.add_argument('--server-name', default='rocketgraph-xgt', + help='XGT service DNS name to verify against its TLS certificate') + parser.add_argument('--demo', choices=['create', 'read', 'cleanup'], + help='Create, read or remove the XgtDemo admin-only table') + args = parser.parse_args() + private = Path(__file__).resolve().parent / '.private' + if args.token_file: + auth = xgt.BearerTokenAuth(args.token_file.read_text().strip()) + else: + auth = xgt.OidcAuth( + flow='auth_code', + client_secret=(private / 'oauth-client-secret').read_text().strip(), + ca_cert_path=str(private / 'oidc-ca.pem')) + conn = xgt.Connection( + host='127.0.0.1', port=args.port, auth=auth, + flags={'ssl': True, + 'ssl_server_cert': str(private / 'xgt-ca.pem'), + 'ssl_server_cn': args.server_name}) + print('Identity:', conn.userid) + print('XGT administrator:', conn.is_admin) + print('Labels:', conn.get_user_labels()) + result = conn.run_job('RETURN 1 AS ok').get_data() + if result != [[1]]: + raise RuntimeError(f'Unexpected query result: {result!r}') + print('Query:', result) + if args.demo == 'create': + if not conn.is_admin: + raise SystemExit('Log in as the XGT administrator to create demo data.') + conn.create_namespace('XgtDemo') + frame = conn.create_table_frame( + 'XgtDemo__AdminOnly', [['value', xgt.INT]], + frame_labels={'read': ['xgtadmin']}) + frame.insert([[42]]) + print('Created XgtDemo__AdminOnly with read label xgtadmin.') + elif args.demo == 'read': + try: + data = conn.get_frame('XgtDemo__AdminOnly').get_data() + except xgt.XgtSecurityError: + if conn.is_admin: + raise + print('PASS: non-admin identity was denied access to admin-only data.') + else: + if not conn.is_admin or data != [[42]]: + raise RuntimeError('Unexpected access to demo data or contents.') + print('PASS: administrator read admin-only data:', data) + elif args.demo == 'cleanup': + if not conn.is_admin: + raise SystemExit('Log in as the XGT administrator to remove demo data.') + conn.drop_namespace('XgtDemo', force_drop=True) + print('Removed the XgtDemo namespace and its demo table.') + + +if __name__ == '__main__': + main() diff --git a/doc/openshift_test_server/make_test_certificates.sh b/doc/openshift_test_server/make_test_certificates.sh new file mode 100644 index 0000000..d3545a1 --- /dev/null +++ b/doc/openshift_test_server/make_test_certificates.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +set -euo pipefail +cd -- "$(dirname -- "$0")" +umask 077 +mkdir -p .private +for name in test-ca.key test-ca.pem xgt-key.pem xgt-cert.pem xgt-ca.pem \ + mongodb-key.pem mongodb-cert.pem mongodb-ca.pem; do + if [ -e ".private/$name" ]; then + echo "Refusing to overwrite .private/$name; use existing certificates." >&2 + exit 1 + fi +done + +# Test-only CA. For a FIPS validation, use an approved certificate/key workflow +# and verify the generating OpenSSL runtime is operating as required. +openssl req -x509 -newkey rsa:3072 -sha256 -nodes -days 30 \ + -keyout .private/test-ca.key -out .private/test-ca.pem \ + -subj '/CN=XGT demo CA' \ + -addext 'basicConstraints=critical,CA:TRUE' \ + -addext 'keyUsage=critical,keyCertSign,cRLSign' + +for service in xgt mongodb; do + extra_sans='' + if [ "$service" = xgt ]; then + for extra in xgt-dev-xgt xgt-prod-xgt; do + extra_sans+=",DNS:$extra,DNS:$extra.xgt-demo.svc,DNS:$extra.xgt-demo.svc.cluster.local" + done + fi + openssl req -new -newkey rsa:3072 -sha256 -nodes \ + -keyout ".private/$service-key.pem" \ + -out ".private/$service.csr" -subj "/CN=rocketgraph-$service" + cat > ".private/$service.ext" < Date: Thu, 1 Oct 2026 11:32:01 -0700 Subject: [PATCH 2/3] Fix namespace in Helm hostname verification example --- charts/rocketgraph/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/rocketgraph/README.md b/charts/rocketgraph/README.md index 1c14933..8eb95f6 100644 --- a/charts/rocketgraph/README.md +++ b/charts/rocketgraph/README.md @@ -606,7 +606,7 @@ xgt: The workload remains a one-replica Deployment. Kubernetes generates its pod name, while the operating-system hostname inside the container is `xgt-test-0`, including after pod replacement. This setting does not create a DNS endpoint: clients use the release's Service, such as `rocketgraph-xgt:4367`. Verify the hostname with: ```bash -oc exec deployment/rocketgraph-xgt -- cat /proc/sys/kernel/hostname +oc -n xgt exec deployment/rocketgraph-xgt -- cat /proc/sys/kernel/hostname ``` For three independent servers, install one release per server. Start with the full test stack, then disable Mission Control and MongoDB in additional releases: From 6e669ed92e8c8fb77184102cb770ed2e2713d5e2 Mon Sep 17 00:00:00 2001 From: Joshua Landwehr Date: Thu, 1 Oct 2026 11:39:58 -0700 Subject: [PATCH 3/3] Use neutral licensed hostnames in deployment examples --- charts/rocketgraph/README.md | 14 ++++++------- .../examples/xgt_existing_files.yaml | 2 +- .../examples/xgt_files_separate_data.yaml | 2 +- .../examples/xgt_openshift_restricted.yaml | 2 +- charts/rocketgraph/tests/test_render.py | 10 +++++----- doc/openshift_fips_deployment.md | 2 +- doc/openshift_fips_values.example.yaml | 2 +- doc/openshift_test_server/README.md | 20 +++++++++---------- doc/openshift_test_server/values.yaml | 2 +- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/charts/rocketgraph/README.md b/charts/rocketgraph/README.md index 8eb95f6..da996e4 100644 --- a/charts/rocketgraph/README.md +++ b/charts/rocketgraph/README.md @@ -164,7 +164,7 @@ By default, the chart generates configuration in a ConfigMap, mounts license/TLS ```yaml xgt: - hostname: xgt-prod-0 + hostname: demo-xgt-prod files: existingClaim: xgt-files subPath: xgt-prod @@ -593,17 +593,17 @@ helm install rocketgraph ./charts/rocketgraph \ For a complete OpenShift LDAP/OAuth walkthrough with YAML and commands, see the [test-server guide](../../doc/openshift_test_server/README.md). -Chart **0.4.0** adds `xgt.hostname` and `missionControl.enabled`. A fixed container hostname supports a hostname-bound license while keeping xGT managed by Helm: +Chart **0.4.0** adds `xgt.hostname` and `missionControl.enabled`. A fixed container hostname supports a hostname-bound license while keeping xGT managed by Helm. The `demo-xgt-*` hostnames below are examples; replace them with hostnames covered by your license: ```yaml xgt: enabled: true - hostname: xgt-test-0 + hostname: demo-xgt-test license: existingSecret: xgt-license ``` -The workload remains a one-replica Deployment. Kubernetes generates its pod name, while the operating-system hostname inside the container is `xgt-test-0`, including after pod replacement. This setting does not create a DNS endpoint: clients use the release's Service, such as `rocketgraph-xgt:4367`. Verify the hostname with: +The workload remains a one-replica Deployment. Kubernetes generates its pod name, while the operating-system hostname inside the container is `demo-xgt-test`, including after pod replacement. This setting does not create a DNS endpoint: clients use the release's Service, such as `rocketgraph-xgt:4367`. Verify the hostname with: ```bash oc -n xgt exec deployment/rocketgraph-xgt -- cat /proc/sys/kernel/hostname @@ -613,14 +613,14 @@ For three independent servers, install one release per server. Start with the fu ```bash helm upgrade --install rocketgraph ./charts/rocketgraph -n xgt \ - -f site-values.yaml --set xgt.hostname=xgt-test-0 + -f site-values.yaml --set xgt.hostname=demo-xgt-test helm upgrade --install xgt-dev ./charts/rocketgraph -n xgt \ - -f site-values.yaml --set xgt.hostname=xgt-dev-0 \ + -f site-values.yaml --set xgt.hostname=demo-xgt-dev \ --set missionControl.enabled=false --set mongodb.enabled=false helm upgrade --install xgt-prod ./charts/rocketgraph -n xgt \ - -f site-values.yaml --set xgt.hostname=xgt-prod-0 \ + -f site-values.yaml --set xgt.hostname=demo-xgt-prod \ --set missionControl.enabled=false --set mongodb.enabled=false ``` diff --git a/charts/rocketgraph/examples/xgt_existing_files.yaml b/charts/rocketgraph/examples/xgt_existing_files.yaml index 1d97cde..944e660 100644 --- a/charts/rocketgraph/examples/xgt_existing_files.yaml +++ b/charts/rocketgraph/examples/xgt_existing_files.yaml @@ -12,7 +12,7 @@ openshift: fips: enabled: true xgt: - hostname: xgt-prod-0 + hostname: demo-xgt-prod image: tag: 2.7.1 files: diff --git a/charts/rocketgraph/examples/xgt_files_separate_data.yaml b/charts/rocketgraph/examples/xgt_files_separate_data.yaml index e6a6c57..88adf05 100644 --- a/charts/rocketgraph/examples/xgt_files_separate_data.yaml +++ b/charts/rocketgraph/examples/xgt_files_separate_data.yaml @@ -12,7 +12,7 @@ openshift: fips: enabled: true xgt: - hostname: xgt-prod-0 + hostname: demo-xgt-prod image: tag: 2.7.1 files: diff --git a/charts/rocketgraph/examples/xgt_openshift_restricted.yaml b/charts/rocketgraph/examples/xgt_openshift_restricted.yaml index c1ff347..0709411 100644 --- a/charts/rocketgraph/examples/xgt_openshift_restricted.yaml +++ b/charts/rocketgraph/examples/xgt_openshift_restricted.yaml @@ -10,7 +10,7 @@ openshift: fips: enabled: true xgt: - hostname: xgt-test-0 + hostname: demo-xgt-test image: tag: 2.7.1 license: diff --git a/charts/rocketgraph/tests/test_render.py b/charts/rocketgraph/tests/test_render.py index 88c20b5..9ffdae3 100644 --- a/charts/rocketgraph/tests/test_render.py +++ b/charts/rocketgraph/tests/test_render.py @@ -55,7 +55,7 @@ def test_three_releases_have_isolated_storage_and_fixed_hostnames(self): 'mongodb': {'enabled': False}, 'openshift': {'enabled': True}, 'fips': {'enabled': True}, - 'xgt': {'hostname': release + '-0', + 'xgt': {'hostname': 'demo-' + release, 'license': {'existingSecret': release + '-license'}, 'ssl': {'enabled': True, 'existingSecret': release + '-tls'}, 'extraConfig': {'security.oidc': {'client_id': release}}}, @@ -63,7 +63,7 @@ def test_three_releases_have_isolated_storage_and_fixed_hostnames(self): deployments = [obj for obj in objects if obj['kind'] == 'Deployment'] self.assertEqual(len(deployments), 1) pod = deployments[0]['spec']['template']['spec'] - self.assertEqual(pod['hostname'], release + '-0') + self.assertEqual(pod['hostname'], 'demo-' + release) self.assertEqual(pod['containers'][0]['image'], 'docker.io/rocketgraph/xgt:2.7.1-fips') secrets = {v['secret']['secretName'] for v in pod['volumes'] if 'secret' in v} @@ -139,8 +139,8 @@ def test_explicit_claims_remain_supported(self): def test_documented_openshift_values_share_one_mission_control(self): path = CHART.parents[1] / 'doc/openshift_test_server/values.yaml' - for release, hostname in [('rocketgraph', 'xgt-test-0'), - ('xgt-dev', 'xgt-dev-0'), ('xgt-prod', 'xgt-prod-0')]: + for release, hostname in [('rocketgraph', 'demo-xgt-test'), + ('xgt-dev', 'demo-xgt-dev'), ('xgt-prod', 'demo-xgt-prod')]: with self.subTest(release=release): values = yaml.safe_load(path.read_text()) if release != 'rocketgraph': @@ -178,7 +178,7 @@ def test_restricted_xgt_has_no_elevated_binding_and_uses_direct_startup(self): self.assertEqual(sum(o['kind'] == 'ServiceAccount' for o in objects), 1) pod = component(objects, 'Deployment', 'xgt')['spec']['template']['spec'] container = pod['containers'][0] - self.assertEqual(pod['hostname'], 'xgt-test-0') + self.assertEqual(pod['hostname'], 'demo-xgt-test') self.assertEqual(pod['securityContext']['seccompProfile']['type'], 'RuntimeDefault') self.assertTrue(container['securityContext']['runAsNonRoot']) self.assertFalse(container['securityContext']['allowPrivilegeEscalation']) diff --git a/doc/openshift_fips_deployment.md b/doc/openshift_fips_deployment.md index d47e522..d047612 100644 --- a/doc/openshift_fips_deployment.md +++ b/doc/openshift_fips_deployment.md @@ -32,7 +32,7 @@ This integration is **OpenShift OAuth2 authentication**. The API remains `xgt.Oi Example names throughout: application namespace `xgt`, automation namespace `xgt-jobs`, Helm release `rocketgraph`, OAuthClient `xgt-client`, and Mission Control `https://mc.apps.example.com`. Replace them consistently. -Example licensed hostnames are `xgt-prod-0`, `xgt-test-0`, and `xgt-dev-0`; obtain a license covering the names used in your installation. Chart 0.4.0 adds `xgt.hostname` to set the container's licensed hostname while retaining Helm's Deployment. A release name alone does not set this hostname. Use a separate Helm release per independent XGT server, each with its own hostname, settings and storage. Additional releases can disable Mission Control and MongoDB and share the first release's Mission Control. The [test-server guide](openshift_test_server/README.md#optional-add-separate-dev-and-prod-xgt-releases) includes commands. +Example licensed hostnames are `demo-xgt-prod`, `demo-xgt-test`, and `demo-xgt-dev`; obtain a license covering the names used in your installation. Chart 0.4.0 adds `xgt.hostname` to set the container's licensed hostname while retaining Helm's Deployment. A release name alone does not set this hostname. Use a separate Helm release per independent XGT server, each with its own hostname, settings and storage. Additional releases can disable Mission Control and MongoDB and share the first release's Mission Control. The [test-server guide](openshift_test_server/README.md#optional-add-separate-dev-and-prod-xgt-releases) includes commands. ## 2. Establish the FIPS and TLS Requirements First diff --git a/doc/openshift_fips_values.example.yaml b/doc/openshift_fips_values.example.yaml index cf060a7..f4f5929 100644 --- a/doc/openshift_fips_values.example.yaml +++ b/doc/openshift_fips_values.example.yaml @@ -10,7 +10,7 @@ fips: enabled: true xgt: - hostname: xgt-test-0 + hostname: demo-xgt-test image: tag: 2.7.1 replicas: 1 diff --git a/doc/openshift_test_server/README.md b/doc/openshift_test_server/README.md index 4eee14b..55e18d7 100644 --- a/doc/openshift_test_server/README.md +++ b/doc/openshift_test_server/README.md @@ -9,7 +9,7 @@ The Python API and Mission Control still call the shared authentication option the OpenShift User API to obtain identity and groups. This flow does not use OIDC ID tokens or a standard OIDC UserInfo endpoint. -**Deployment:** Helm manages XGT, Mission Control and MongoDB. Set `xgt.hostname: xgt-test-0` for the licensed container hostname. The Kubernetes pod name remains generated. Optional separate releases provide dev and prod XGT servers with their own configuration and storage, sharing Mission Control. +**Deployment:** Helm manages XGT, Mission Control and MongoDB. Set `xgt.hostname: demo-xgt-test` for the licensed container hostname. The Kubernetes pod name remains generated. Optional separate releases provide dev and prod XGT servers with their own configuration and storage, sharing Mission Control. **Requires chart 0.4.0 or later; the commands below use the chart in this repository.** Rendering has been checked, and an isolated XGT 2.7.1 FIPS-image release passed license validation, OpenShift token login and a query. Its fixed hostname and a file on its data volume survived pod replacement. The complete installation below has not been deployed to a fresh cluster. The [deployment planning guide](../openshift_fips_deployment.md) covers the architecture and FIPS verification responsibilities. @@ -42,7 +42,7 @@ oc get nodes oc get storageclass ``` -Get a license for `xgt-test-0`, directory access details, and two LDAP test users: +The `demo-xgt-*` hostnames are examples. Obtain a license covering them, or replace them in the values and commands with hostnames covered by your own license. For the initial server, use `demo-xgt-test` or your licensed replacement. Also obtain directory access details and two LDAP test users: | User | LDAP memberships | Expected XGT access | | --- | --- | --- | @@ -242,7 +242,7 @@ oc -n xgt-demo get secrets In `values.yaml`, set the actual OAuth issuer under `xgt.extraConfig.security.oidc` and set `backend.oidc.frontendUrl` to the public Mission Control URL. This URL must match `route.yaml` and the callback registered in step 5. -`xgt.config` contains the group-to-label mappings; `xgt.extraConfig` holds server settings. Keep `xgt.enabled: true` and `xgt.hostname: xgt-test-0`. Helm's `fips.enabled: true` selects the XGT/Mission Control FIPS images and the chart's default Percona MongoDB image; no MongoDB image override is needed. Base XGT/Mission Control tags stay unsuffixed. Use an approved chart revision and review the rendered images before installing or upgrading. +`xgt.config` contains the group-to-label mappings; `xgt.extraConfig` holds server settings. Keep `xgt.enabled: true` and set `xgt.hostname` to the hostname covered by your license (`demo-xgt-test` in this example). Helm's `fips.enabled: true` selects the XGT/Mission Control FIPS images and the chart's default Percona MongoDB image; no MongoDB image override is needed. Base XGT/Mission Control tags stay unsuffixed. Use an approved chart revision and review the rendered images before installing or upgrading. ```sh helm template rocketgraph ../../charts/rocketgraph \ @@ -258,7 +258,7 @@ oc -n xgt-demo get pods,pvc oc -n xgt-demo exec deployment/rocketgraph-xgt -- cat /proc/sys/kernel/hostname ``` -**Expected:** four ready application pods, bound PVCs, and hostname `xgt-test-0`. XGT uses TLS; MongoDB uses authentication, required TLS and `--tlsFIPSMode`. Check logs and the actual crypto configuration for FIPS acceptance; do not disable verification to pass the test. +**Expected:** four ready application pods, bound PVCs, and hostname `demo-xgt-test`. XGT uses TLS; MongoDB uses authentication, required TLS and `--tlsFIPSMode`. Check logs and the actual crypto configuration for FIPS acceptance; do not disable verification to pass the test. All application workloads are managed with Helm. After editing XGT settings or mappings in `values.yaml`, rerun the same `helm upgrade --install` command. The chart's configuration checksum triggers a new XGT pod. External Secret changes may require a rollout restart. @@ -266,25 +266,25 @@ All application workloads are managed with Helm. After editing XGT settings or m Use one Helm release per XGT server. These are independent servers, not replicas or an HA cluster. Each receives separate configuration, Services and data/log PVCs. The commands below reuse the test settings; add a per-environment values file when settings differ. -First ensure the license covers `xgt-dev-0` and `xgt-prod-0`. XGT TLS certificates must cover each release's Service name. The optional test certificate script includes all three names. For separate production certificates, create separate Secrets and override `xgt.ssl.existingSecret`; include their issuing CAs in Mission Control's `backend-tls` trust bundle. Override `xgt.license.existingSecret` if licenses are separate. +First ensure the license covers `demo-xgt-dev` and `demo-xgt-prod`. XGT TLS certificates must cover each release's Service name. The optional test certificate script includes all three names. For separate production certificates, create separate Secrets and override `xgt.ssl.existingSecret`; include their issuing CAs in Mission Control's `backend-tls` trust bundle. Override `xgt.license.existingSecret` if licenses are separate. ```sh helm upgrade --install xgt-dev ../../charts/rocketgraph \ -n xgt-demo -f values.yaml \ --set missionControl.enabled=false --set mongodb.enabled=false \ - --set xgt.hostname=xgt-dev-0 --wait --timeout=10m + --set xgt.hostname=demo-xgt-dev --wait --timeout=10m helm upgrade --install xgt-prod ../../charts/rocketgraph \ -n xgt-demo -f values.yaml \ --set missionControl.enabled=false --set mongodb.enabled=false \ - --set xgt.hostname=xgt-prod-0 --wait --timeout=10m + --set xgt.hostname=demo-xgt-prod --wait --timeout=10m ``` | Helm release | Licensed container hostname | XGT endpoint | Includes Mission Control/MongoDB | | --- | --- | --- | --- | -| `rocketgraph` | `xgt-test-0` | `rocketgraph-xgt:4367` | Yes | -| `xgt-dev` | `xgt-dev-0` | `xgt-dev-xgt:4367` | No | -| `xgt-prod` | `xgt-prod-0` | `xgt-prod-xgt:4367` | No | +| `rocketgraph` | `demo-xgt-test` | `rocketgraph-xgt:4367` | Yes | +| `xgt-dev` | `demo-xgt-dev` | `xgt-dev-xgt:4367` | No | +| `xgt-prod` | `demo-xgt-prod` | `xgt-prod-xgt:4367` | No | `xgt.enabled` stays `true` for all three. The shared Mission Control's `backend.oidc.xgtAllowedHosts` already lists these endpoints. Leave `backend.env.XGT_SERVER_CN` unset so TLS checks each selected endpoint's certificate identity. XGT-only releases still use `backend.oidc.caCertExistingSecret` to mount the OAuth/API CA bundle. diff --git a/doc/openshift_test_server/values.yaml b/doc/openshift_test_server/values.yaml index c095afa..7ed545f 100644 --- a/doc/openshift_test_server/values.yaml +++ b/doc/openshift_test_server/values.yaml @@ -8,7 +8,7 @@ fips: enabled: true xgt: enabled: true - hostname: xgt-test-0 + hostname: demo-xgt-test image: tag: 2.7.1 license: