Skip to content

Surface assignment vocabulary on CLI flags and Web UI routes - #140

Open
scott-rc wants to merge 3 commits into
sc/assignment-redesign-2from
sc/assignment-redesign-3
Open

scott-rc wants to merge 3 commits into
sc/assignment-redesign-2from
sc/assignment-redesign-3

Conversation

@scott-rc

@scott-rc scott-rc commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Phase 3 of the assignment-redesign plan. Stacked on #139.

Operators with shipped manifests passing --function-* flags or SKIPPER_FUNCTION_* env vars need binaries to keep parsing those names through the deprecation window, and tenants visiting /functions/... URLs in the dashboard need to land somewhere coherent. This phase adds the canonical assignment-named surfaces alongside the legacy ones; the cleanup followup plan removes the legacy half after a deploy plus deprecation window.

CLI flags and env vars

The config binder's flag struct tag now accepts comma-separated names: first is canonical, rest are deprecated aliases. Aliases register as hidden flags, derive their own SKIPPER_* env-var fallbacks, and emit a one-shot deprecation log on first use of either form.

Controller fields rename to AssignmentNamespaces, AssignPath, AssignTimeout with --assignment-namespaces, --assign-path, --assign-timeout as canonical and the legacy --function-namespaces, --function-assign-path, --function-assign-timeout as aliases.

Dev tooling (cmd/dev/up.go, cmd/dev/deploy.go, cmd/dev/kube_lint.go, internal/dev/krane/krane_test.go) and the krane goldens migrate to SKIPPER_ASSIGNMENT_NAMESPACES and assignment_namespaces as the canonical names. template.yaml.erb accepts either assignment_namespaces or function_namespaces as input but always emits SKIPPER_ASSIGNMENT_NAMESPACES.

Web UI

/assignments, /assignments/{key}, /sse/assignments, and /sse/assignment/{key} are the canonical routes; the legacy /functions/* and /sse/function* paths return 301 to their assignment counterparts (preserving query strings). Datastar's EventSource follows the 30x on the initial handshake.

Templates function.html and functions.html rename to assignment.html / assignments.html. The assignmentsData Go struct's signal fields rename to AssignmentSearch/AssignmentSort/AssignmentSortDir (JSON tags assignmentSearch etc.), the events page's signal renames eventFunction to eventAssignment, and tenantRow.Functions / controllerRow.Functions / routerRow.Functions rename to Assignments. Templates surface "Assignments" instead of "Functions" in nav links, page titles, stat-card labels, and column headers.

activeNav highlights /assignments for both function- and assignment-prefixed page titles. The /events page accepts ?assignment= and falls back to ?function= (new wins on conflict).

Tests

  • New TestFlagAliases cases cover the canonical/alias flag form, env-var fallback for the alias, hidden flag bit, and description content.
  • New controller_test.go case covers the --function-namespaces legacy alias still flowing into AssignmentNamespaces.
  • New TestLegacyRoutesRedirect (and TestSSELegacyRoutesRedirect) cover the 301 from /functions/* and /sse/functions/*.
  • Events filter tests gain ?assignment=, legacy ?function=, and the new-wins-on-conflict cases.
  • Goldens regenerated: internal/cmd/testdata/help_controller.golden, all 10 internal/dev/krane/testdata/*.golden.yaml files.

Test plan

  • dev test passes
  • dev lint clean
  • dev kube-lint clean
  • Manual: --function-namespaces=... parses and emits a deprecation log
  • Manual: GET /functions returns 301 to /assignments; GET /sse/functions returns 301 to /sse/assignments

Extend the config flag binder to accept comma-separated `flag` tag names:
the first is canonical, the rest are deprecated aliases. Each alias gets
a hidden flag and an env-var fallback that emits a one-shot deprecation
log on first use.

Controller flags rename to `--assignment-namespaces`, `--assign-path`,
and `--assign-timeout`, with the legacy `--function-*` forms registered
as aliases. Dev tooling (cmd/dev, krane goldens, template.yaml.erb)
moves to `SKIPPER_ASSIGNMENT_NAMESPACES` as the canonical env var; the
erb input also accepts `function_namespaces` during the transition.

Web UI serves `/assignments`, `/assignments/{key}`, `/sse/assignments`,
and `/sse/assignment/{key}`; the legacy `/functions/*` and
`/sse/function*` paths return 301 to their assignment counterparts.
Templates rename to `assignment.html` / `assignments.html`, Datastar
signals rename (`fnSearch` -> `assignmentSearch`, `eventFunction` ->
`eventAssignment`, etc.), and `activeNav` highlights `/assignments` for
both prefixes. The `/events` page reads `?assignment=` and falls back
to `?function=` (new wins on conflict).

Internal Go renames: controller.Config fields become
AssignmentNamespaces / AssignPath / AssignTimeout, web.tenantRow et al
gain Assignments fields, and the `functionPath` template helper becomes
`assignmentPath`.
@scott-rc

scott-rc commented May 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Comment thread internal/config/config.go Outdated
logDeprecation concatenated subject and identifier with a space, but
both callers already embedded the identifier in subject. Drop the
redundant `used` parameter and use the subject text as the dedup key.

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 09f2431. Configure here.

Comment thread internal/config/config_test.go Outdated
The reset delete used the bare env var name as the key, but
logDeprecation stores keys with the "env " prefix, so the reset was a
no-op. Use the prefixed form to match.

This branch has not been deployed

No deployments
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.

1 participant