Skip to content

feat(powfaucet): create the ingress' basic-auth secret from a value - #493

Merged
qu0b merged 3 commits into
masterfrom
qu0b/powfaucet-ingress-basic-auth
Aug 21, 2026
Merged

qu0b merged 3 commits into
masterfrom
qu0b/powfaucet-ingress-basic-auth

Conversation

@qu0b

@qu0b qu0b commented Aug 21, 2026

Copy link
Copy Markdown
Member

Problem

Gating the faucet behind nginx basic auth today means setting the two annotations in values and creating the Secret they reference somewhere else — by hand, or in whatever renders the values. The chart has no idea its ingress depends on that object.

That fails badly: when the secret is missing, the ingress controller does not fall through to the upstream, it returns 503 for the whole host, unauthenticated requests included. A network that forgot the manual step serves a dead faucet with nothing in the response pointing at the cause. One of ours has been in that state since it was deployed.

Change

ingress.basicAuth takes the htpasswd line. Set it and the chart creates <fullname>-basic-auth and sets auth-type / auth-secret for you; leave it empty and nothing changes.

nginx accepts user:{PLAIN}password as well as a hashed line, so deployments that resolve credentials from a secret store at sync time can pass the credential straight through without pre-hashing it.

Compatibility

Additive, empty default, hence the minor bump to 1.2.0. Rendered with --set ingress.enabled=true and no basicAuth:

  • no Secret is produced
  • the Ingress is byte-identical to 1.1.0 apart from the chart version label

With --set 'ingress.basicAuth=srv:{PLAIN}hunter2':

kind: Secret
metadata:
  name: pf-powfaucet-basic-auth
stringData:
  auth: "srv:{PLAIN}hunter2"
---
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/auth-secret: pf-powfaucet-basic-auth
    nginx.ingress.kubernetes.io/auth-type: basic

helm lint clean, README regenerated with make docs.

Gating the faucet behind nginx basic auth currently means the annotations
in values plus a Secret created outside the chart, by hand or by whatever
renders the values. Nothing in the chart says the ingress depends on that
secret, so a network that forgets it gets a 503 on the whole host with
nothing to point at the cause.

Take the htpasswd line as a value instead: set ingress.basicAuth and the
chart creates the secret and sets the two annotations that reference it.
Default is empty, so charts that set nothing render exactly as before.
@qu0b
qu0b requested a review from skylenet as a code owner August 21, 2026 09:34
@redpandabot

This comment has been minimized.

Review catch: `set .Values.ingress.annotations` assumes the map exists.
`ingress.annotations: null` is a valid way to write "no annotations" and
rendered fine before, but with basicAuth set it took the whole release
down with "wrong type for value; expected map[string]interface {}".

Build the map with `default dict` and write it back instead.
@qu0b

qu0b commented Aug 21, 2026

Copy link
Copy Markdown
Member Author

Good catch, fixed in the follow-up commit.

ingress.annotations: null is a legitimate way to write "no annotations" and rendered fine before, but set on it took the whole release down:

Error: template: powfaucet/templates/ingress.yaml:10:21: executing "powfaucet/templates/ingress.yaml"
at <.Values.ingress.annotations>: wrong type for value; expected map[string]interface {}; got interface {}

Now the map is built with default dict and written back, so all four combinations render:

annotations basicAuth result
null set both auth annotations, no error
{} (default) set both auth annotations
existing entry set merged, existing entry preserved
null unset no auth annotations, no Secret

helm lint still clean.

@redpandabot redpandabot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds an opt-in ingress basic-auth: setting ingress.basicAuth makes the chart create a -basic-auth Secret and the nginx auth-type/auth-secret annotations, with an empty default so non-users see no change. I rendered the chart in all relevant configurations (no-auth vs 1.1.0 byte-identical, basicAuth, null annotations, custom annotations, ingress disabled) and verified the nginx-facing details against upstream source (ingress-nginx reads secret key 'auth' and resolves a bare auth-secret name to the ingress's own namespace; nginx's ngx_crypt accepts {PLAIN}/{SHA}/{SSHA}/$apr1$). helm lint is clean; the .Values mutation is the repo's established ingress-template pattern with no cross-template leak. No correctness problems found.


Reviewed 5 changed file(s) @ 2d739d53 — no blocking issues found.
"Pets vs. cattle." — Bill Baker

@qu0b
qu0b merged commit 8c6d6cc into master Aug 21, 2026
14 checks passed
@qu0b
qu0b deleted the qu0b/powfaucet-ingress-basic-auth branch August 21, 2026 10:02
qu0b added a commit to ethpandaops/ansible-collection-general that referenced this pull request Aug 21, 2026
…t's basicAuth (#579)

## Problem

The `faucet-agents` ingress asks for basic auth, but the secret it
references was never created — the role told the operator to make it by
hand:

> create the htpasswd secret with the srv credential in the network's
namespace

Skipping that does not leave the faucet open, it leaves it dead, and
silently: the ingress controller returns `503` for the whole host,
unauthenticated requests included, so nothing in the response points at
the missing object.

`glamsterdam-devnet-8` has been in that state since it was deployed —
503 with and without credentials, where devnet-7 returns 401 because
someone created the secret by hand. `evm.faucet` through the panda proxy
fails on devnet-8 with the ingress' own 503 body.

## Change

The chart creates the secret now (ethpandaops/ethereum-helm-charts#493,
powfaucet 1.2.0), so this side is just the credential, passed the same
way as every other secret we hand to a service. The annotations come
with it, so they leave here — the diff is a net six lines lighter.

The credential is `node_ingress`, the one the old annotation comment
already named, and present as `username`/`password` for all 14
`testnets.*` entries.

## Verification

Regenerated against the real `glamsterdam-devnet-8` inventory, with the
1.2.0 chart, and rendered the result:

```yaml
# faucet-agents/values.yaml
  ingress:
    enabled: true
    className: ingress-nginx-public
    basicAuth: "<path:...node_ingress.username}>:{PLAIN}<path:...node_ingress.password}>"
```

```yaml
# helm template faucet-agents ./faucet-agents
kind: Secret
metadata:
  name: powfaucet-agents-basic-auth
---
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/auth-secret: powfaucet-agents-basic-auth
    nginx.ingress.kubernetes.io/auth-type: basic
```

The secret keeps the name the annotation used before, which is also the
name of the one already sitting in devnet-7's namespace, so ArgoCD
adopts that one rather than creating a second.

- the browser `faucet` chart renders no Secret and is otherwise
unchanged
- `{PLAIN}` checked against nginx directly: no credentials → 401, wrong
credentials → 401, correct credentials → 200
- `ansible-lint` clean on the production profile

One behaviour change worth naming: the realm string (`auth-realm: "panda
proxy only"`) goes away with the annotations, so the browser prompt
shows nginx's default realm.

## Merge order

ethpandaops/ethereum-helm-charts#493 first, then a chart release, since
the dependency pin here moves to 1.2.0.
qu0b added a commit to ethpandaops/glamsterdam-devnets that referenced this pull request Aug 21, 2026
)

The faucet-agents ingress has asked for basic auth since it was deployed,
but the secret it referenced was never created — that step was manual and
got missed here, so the ingress has been returning 503 for the whole host
ever since, unauthenticated requests included. devnet-7 works because
someone created the secret there by hand.

powfaucet 1.2.0 takes the htpasswd line as a value and creates the secret
itself (ethpandaops/ethereum-helm-charts#493), and the ansible template
passes the srv credential straight from vault
(ethpandaops/ansible-collection-general#579), so regenerating is enough.
The secret keeps the name the annotation used, so nothing else moves.

Also pin the display name the generated values have been carrying by hand
since 3502cc6 and 035e55b, so the next regeneration stops reverting it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants