Skip to content

Commit 9c267ca

Browse files
committed
feat(helm): enable auth by default with Hubble opt-in
Default installs get a chart-managed admin Secret; leave Hubble off so API-only clusters stay lean, and enable the UI with one flag when wanted.
1 parent c5db3e7 commit 9c267ca

5 files changed

Lines changed: 74 additions & 31 deletions

File tree

.github/workflows/helm-chart-ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,17 @@ jobs:
8484
helm template ci helm/hugegraph -f helm/hugegraph/values-single.yaml \
8585
| grep -qF 'value: "-Dpartition.default-shard-count=1"'
8686
# The stock distributed install must put every Server replica on
87-
# the shared PD graph catalog, even without auth or Hubble.
87+
# the shared PD graph catalog, even without Hubble. Auth is on by
88+
# default, so the chart-managed admin Secret must render too.
8889
DEFAULT=$(helm template ci helm/hugegraph)
8990
grep -qF "printf 'usePD=true\\n'" <<<"$DEFAULT"
9091
grep -qF "printf 'pd.peers=%s\\n' \"\${HG_SERVER_PD_PEERS}\"" \
9192
<<<"$DEFAULT"
9293
grep -qF 'value: "ci-hugegraph-pd-0.ci-hugegraph-pd.default.svc:8686,ci-hugegraph-pd-1.ci-hugegraph-pd.default.svc:8686,ci-hugegraph-pd-2.ci-hugegraph-pd.default.svc:8686"' \
9394
<<<"$DEFAULT"
95+
grep -qE '^kind: Secret$' <<<"$DEFAULT"
96+
grep -qF 'name: ci-admin' <<<"$DEFAULT"
97+
grep -qF 'name: ci-auth-token' <<<"$DEFAULT"
9498
9599
- name: reject invalid values
96100
run: |
@@ -113,7 +117,9 @@ jobs:
113117
--set server.pdb.enabled=true \
114118
--set server.pdb.minAvailable=2
115119
must_fail --set server.auth.enabled=true --set server.auth.autoGenerateSecret=false
116-
must_fail --set hubble.enabled=true
120+
# Auth defaults to on, so Hubble alone is valid; refuse Hubble only
121+
# when authentication is explicitly disabled.
122+
must_fail --set hubble.enabled=true --set server.auth.enabled=false
117123
A=(--set hubble.enabled=true --set hubble.allowWithoutServerAuth=true)
118124
must_fail "${A[@]}" --set hubble.port=0
119125
must_fail "${A[@]}" \

helm/hugegraph/README.md

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,28 @@ This deploys 3 PD + 3 Store + 3 Server, preserves the image's automatic JVM
7676
sizing, and sets no resource requests or limits. Set resources before
7777
production use.
7878

79+
**Authentication is enabled by default.** The chart creates a kept Secret
80+
named `<release>-admin` (for example `hugegraph-admin`) with a random
81+
password unless `server.auth.existingSecret` points at a pre-created Secret.
82+
Read the password and exercise the API:
83+
84+
```bash
85+
PASSWORD="$(kubectl get secret -n hugegraph hugegraph-admin \
86+
-o jsonpath='{.data.password}' | base64 --decode)"
87+
kubectl port-forward -n hugegraph svc/hugegraph-server 8080:8080
88+
curl --user "admin:${PASSWORD}" http://127.0.0.1:8080/versions
89+
```
90+
91+
**Hubble is not installed by default.** Enable the optional UI after install:
92+
93+
```bash
94+
helm upgrade --install hugegraph ./helm/hugegraph --namespace hugegraph \
95+
--set hubble.enabled=true
96+
```
97+
98+
Auth is already on, so that single flag is enough. Login uses the same admin
99+
credential from the chart-managed (or BYO) Secret.
100+
79101
The default anti-affinity for `pd`, `store`, and `server` is `preferred`
80102
(Server always was; Hubble has no anti-affinity knob because it is
81103
single-replica by design), so the chart schedules even on clusters with
@@ -105,9 +127,9 @@ helm test hugegraph --namespace hugegraph
105127

106128
| File | Purpose |
107129
|---|---|
108-
| `values.yaml` | Default 3+3+3 topology with preferred anti-affinity, so it schedules on clusters of any node count |
109-
| `values-single.yaml` | Single-node 1+1+1 example |
110-
| `values-cluster.yaml` | Production 3+3+3 starting point with JVM/resources, PD/Store PDBs, and required anti-affinity for PD and Store; Hubble stays opt-in because the preset does not enable authentication |
130+
| `values.yaml` | Default 3+3+3 topology with preferred anti-affinity, authentication on, and Hubble off |
131+
| `values-single.yaml` | Single-node 1+1+1 example with authentication on |
132+
| `values-cluster.yaml` | Production 3+3+3 starting point with JVM/resources, PD/Store PDBs, and required anti-affinity for PD and Store; authentication on, Hubble still opt-in |
111133

112134
`values-cluster.yaml` is a production starting point, not a capacity
113135
guarantee. Recalculate capacity for the graph size, traffic, failure budget,
@@ -287,7 +309,7 @@ default values.
287309
| `server.restServer.minFreeMemory` | Empty preserves the image default | `""` |
288310
| `server.restServer.batchMaxWriteThreads` | Empty preserves the image default | `""` |
289311
| `server.initStoreEnabled` | Must remain `false` for distributed HStore | `false` |
290-
| `server.auth.enabled` | Enable admin authentication | `false` |
312+
| `server.auth.enabled` | Enable admin authentication | `true` |
291313
| `server.auth.autoGenerateSecret` | Create and keep a random release-admin Secret when `existingSecret` is empty | `true` |
292314
| `server.auth.existingSecret` | Use a pre-created Secret instead; it must contain key `password` and takes priority | `""` |
293315
| `server.auth.tokenSecret.existingSecret` | BYO Secret for the JWT signing key (`auth.token_secret`); empty creates a kept release-auth-token Secret | `""` |
@@ -316,7 +338,11 @@ utilization-based HPA requires a strictly positive
316338

317339
Set `hubble.enabled=true` to deploy [HugeGraph Hubble](https://hugegraph.apache.org/docs/quickstart/toolchain/hugegraph-hubble/),
318340
the web UI for graph management, schema browsing, Gremlin queries, and the
319-
cluster operations view. `hubble.mode` selects the wiring. In the default
341+
cluster operations view. A default install leaves Hubble off so API-only
342+
clusters stay lean; authentication is already on, so enabling the UI is a
343+
single flag (see Installing above). Login uses the admin credential from
344+
`server.auth.existingSecret` or the chart-managed `<release>-admin` Secret.
345+
`hubble.mode` selects the wiring. In the default
320346
`pd` mode the chart points `pd.peers` at the PD gRPC peers, `pd.server` at
321347
the PD client Service REST port, and the Store metrics allow-list at the
322348
Store REST endpoints, so the cluster view works without manual wiring; the
@@ -344,16 +370,13 @@ stored metadata), `size` and `storageClassName` apply at install time only,
344370
and a non-root `podSecurityContext` needs a matching `fsGroup` so H2 can
345371
write the volume.
346372

347-
**Enable `server.auth` when using Hubble.** Current Hubble images gate the
348-
UI behind a login that authenticates against the cluster; with server
349-
authentication disabled the login cannot complete (the server rejects
350-
`/auth/login` with "Unconfigured authenticator"), so Hubble is only useful
351-
on an auth-enabled deployment, where the admin credential from
352-
`server.auth.existingSecret` or the chart-managed admin Secret logs in.
353-
The chart therefore refuses to render
354-
`hubble.enabled=true` without `server.auth` unless
355-
`hubble.allowWithoutServerAuth=true` explicitly overrides it for images
356-
whose login does not need cluster authentication.
373+
**Current Hubble images still require `server.auth`.** The UI login
374+
authenticates against the cluster; with authentication explicitly disabled
375+
the login cannot complete (the server rejects `/auth/login` with
376+
"Unconfigured authenticator"). The chart therefore refuses to render
377+
`hubble.enabled=true` when `server.auth.enabled=false` unless
378+
`hubble.allowWithoutServerAuth=true` overrides it for images whose login
379+
does not need cluster authentication.
357380

358381
**Hubble serves plain HTTP.** Reach it with `kubectl port-forward` or behind
359382
an HTTPS-terminating Ingress; never expose the port directly to an untrusted
@@ -443,9 +466,11 @@ before anything reaches the cluster:
443466
### Connecting to the Cluster
444467

445468
```bash
469+
PASSWORD="$(kubectl get secret -n hugegraph hugegraph-admin \
470+
-o jsonpath='{.data.password}' | base64 --decode)"
446471
kubectl port-forward -n hugegraph svc/hugegraph-server 8080:8080
447-
curl http://127.0.0.1:8080/versions
448-
curl http://127.0.0.1:8080/graphs
472+
curl --user "admin:${PASSWORD}" http://127.0.0.1:8080/versions
473+
curl --user "admin:${PASSWORD}" http://127.0.0.1:8080/graphs
449474
```
450475

451476
### Cluster Health
@@ -684,13 +709,13 @@ independently of the release name.
684709
valid for a root image; `podSecurityContext` and `securityContext` are fully
685710
configurable per component.
686711
- `values-cluster.yaml` is a starting point, not a capacity guarantee.
687-
- The auth Secret sets the admin password only at first creation via
688-
`auth.admin_pa`; the chart cannot rotate an existing cluster's admin
689-
password.
690-
- With authentication enabled, every Server replica must share one JWT
691-
signing key. The chart injects `HG_SERVER_AUTH_TOKEN_SECRET` from
692-
`server.auth.tokenSecret` (chart-managed by default) so Hubble login
693-
stays stable behind a multi-replica Service.
712+
- Authentication is on by default. The auth Secret sets the admin password
713+
only at first creation via `auth.admin_pa`; the chart cannot rotate an
714+
existing cluster's admin password.
715+
- Every Server replica must share one JWT signing key. The chart injects
716+
`HG_SERVER_AUTH_TOKEN_SECRET` from `server.auth.tokenSecret`
717+
(chart-managed by default) so Hubble login stays stable behind a
718+
multi-replica Service.
694719
- Hubble is single-replica, serves plain HTTP, requires `server.auth` to be
695720
enabled for its login to complete, and keeps UI connection metadata,
696721
including any graph credentials entered in the UI, in an embedded H2

helm/hugegraph/values-cluster.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,17 @@ server:
8686
memory: 2Gi
8787
hpa:
8888
enabled: false
89+
# Auth is on by default (chart-managed admin Secret). Pin it here so a
90+
# production overlay cannot accidentally drop authentication.
91+
auth:
92+
enabled: true
93+
autoGenerateSecret: true
94+
existingSecret: ""
8995

90-
# The optional Hubble UI is not enabled here: this preset does not enable
91-
# server authentication, and current Hubble images cannot complete their
92-
# login against an auth-less cluster. Enable it together with server.auth,
93-
# starting from:
96+
# The optional Hubble UI is not enabled here: authentication is already on
97+
# by default, so turn Hubble on with --set hubble.enabled=true (or the
98+
# snippet below) when the browser UI is wanted. Current Hubble images still
99+
# refuse to render if server.auth is explicitly disabled.
94100
#
95101
# hubble:
96102
# enabled: true

helm/hugegraph/values-single.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,7 @@ server:
3838
replicas: 1
3939
hpa:
4040
enabled: false
41+
auth:
42+
enabled: true
43+
autoGenerateSecret: true
44+
existingSecret: ""

helm/hugegraph/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,9 @@ server:
247247
# HG_SERVER_SKIP_INIT and no init Job.
248248
initStoreEnabled: false
249249
auth:
250-
enabled: false
250+
# On by default: a chart-managed release-admin Secret supplies the password
251+
# unless existingSecret is set. Set enabled=false only for trusted networks.
252+
enabled: true
251253
autoGenerateSecret: true
252254
# Secret must contain key "password" (no newlines). Applied as
253255
# auth.admin_pa when the admin account is first created; changing the

0 commit comments

Comments
 (0)