fix(secretengine): report a full volume as an environment failure, not a bad credential (#1842)

This commit is contained in:
sam committed 2026-11-09 14:37:17 +11:00
1 parent 96236b6186
commit 70eef0ec99
3 files changed
+58 -5

No files matched your search

+2 -1
View File
@@ -3,6 +3,7 @@ package extension
import (
"context"
"errors"
"fmt"
"net"
"net/http"
"os"
@@ -24,7 +25,7 @@ type gate struct {
func openGate(ctx context.Context, allow []string) (*gate, error) {
dir, err := os.MkdirTemp("", "archie-ext-")
if err != nil {
return nil, err
return nil, fmt.Errorf("create egress directory in %s: %w", os.TempDir(), err)
}
g := &gate{dir: dir, socket: filepath.Join(dir, "egress.sock")}
ln, err := (&net.ListenConfig{}).Listen(ctx, "unix", g.socket)
@@ -11,6 +11,7 @@ import (
"path/filepath"
"slices"
"sync"
"syscall"
"time"
"github.com/samcharles93/archie-core/internal/domain/applystatus"
@@ -177,6 +178,13 @@ func (r *Runner) ensure(ctx context.Context, pkg storepkg.Installed, setting con
spec := extension.Spec{Name: pkg.Name, Path: binary, SHA256: sum, Env: slices.Clone(pkg.AcceptedAuthority.Env), Egress: slices.Clone(pkg.AcceptedAuthority.EgressHosts)}
engine, err := Start(ctx, r.host, spec, setting.Settings)
if err != nil {
if errors.Is(err, syscall.ENOSPC) || errors.Is(err, syscall.EDQUOT) {
// Registered so references report the exhausted resource instead
// of an engine that is not registered. The empty digest makes the
// next sync start it again.
r.registry.Register(&failedEngine{name: pkg.Name, err: err})
r.running[pkg.Name] = runningEngine{}
}
return err
}
engine.version = pkg.Descriptor.Version
@@ -208,3 +216,14 @@ func Supervise(ctx context.Context, registry *secret.Registry, source Source, pr
go runner.Run(ctx, applystatus.RestampInterval)
return runner
}
// failedEngine answers every resolution with the error that kept its
// extension from starting.
type failedEngine struct {
name string
err error
}
func (e *failedEngine) Name() string { return e.name }
func (e *failedEngine) Resolve(string) (string, error) { return "", e.err }