K8s Resource Input

K8s Resource Input is a copy-paste React component that stops pod asks for 500 cpu cores before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/k8s-resource-input
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsPod asks for 500 CPU cores

Was this component page useful?

How do I install K8s Resource Input?

pnpm dlx shadcn@latest add @bollard/k8s-resource-input

The files land in your project. They're yours to edit.

How do I use K8s Resource Input in React?

k8s-resource-input-usage.tsx
import { K8sResourceInput } from "@/components/ui/k8s-resource-input"

return <K8sResourceInput defaultValue={{ cpu: { request: "500", limit: "1" }, memory: { request: "1Gi", limit: "1G" } }} node={{ cpu: "3920m", memory: "15Gi" }} />

What input mistakes does K8s Resource Input catch?

  • CPU 500 meaning 500 cores
  • Memory 400m meaning 0.4 bytes, and MB/Gb style unit slips
  • A limit below its request (1G vs 1Gi)
  • CPU finer than 1m, which the API rounds
  • Requests larger than your biggest node

What props does K8s Resource Input accept?

K8sResourceInput props
PropTypeDefault
value

Controlled requests and limits for one container.

K8sResources—
defaultValue

Initial requests and limits when uncontrolled.

K8sResourcesEMPTY
onValueChange

Called with all four values on every edit, fix or YAML paste.

(value: K8sResources) => void—
node

Allocatable CPU and memory of your largest node; requests above it are flagged as never schedulable.

NodeCapacity—
messages

Every visible string. `{field}`, `{value}` and the other placeholders are filled in.

Partial<K8sResourceInputMessages>—

* required. Also accepts the native props of <fieldset> (className, aria-*, data-*…), passed through to it.

How is K8s Resource Input accessible?

  • Each field has a visible label and is described by its plain-units readback
  • aria-invalid on flagged fields; status uses role=status
  • Focus returns to a nearby control after a fix

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

  • Node size comes from the node prop; it doesn't query the cluster
  • Doesn't check LimitRanges, ResourceQuotas or ephemeral storage
  • QoS class is computed for this container only, not the whole pod

What validation rules apply to K8s Resource Input?

Rules last verified:

Informational. Confirmed the case-sensitive suffix warning (400m of memory is 0.4 bytes). Rounding and QoS rules were not re-checked this round. Copied components don't update themselves, so re-check after rule changes (see updating a component).

What expensive mistakes does K8s Resource Input stop?

Pod asks for 500 CPU cores

Also known as

kubernetes · k8s · resources requests limits · cpu memory · millicores · Mi Gi · deployment yaml · qos class

Field type

What dependencies does K8s Resource Input require?

K8s Resource Input facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameK8s Resource Input
Registry identifier@bollard/k8s-resource-input
Install commandnpx shadcn@latest add @bollard/k8s-resource-input
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about K8s Resource Input

What form validation mistake does K8s Resource Input catch?

K8s Resource Input prevents pod asks for 500 CPU cores. Reads Kubernetes CPU and memory requests back in plain units, so 500 meaning 500 cores or 400m meaning 0.4 bytes is caught before deploy. Catches: CPU 500 meaning 500 cores, Memory 400m meaning 0.4 bytes, and MB/Gb style unit slips, A limit below its request (1G vs 1Gi), CPU finer than 1m, which the API rounds, Requests larger than your biggest node. Limitation: validate k8s-resource-input schemas on backend.

How do I install k8s-resource-input with shadcn?

Run `npx shadcn@latest add @bollard/k8s-resource-input`. Sources added: registry/default/k8s-resource-input/k8s-quantity.ts, registry/default/k8s-resource-input/k8s-resource-input.tsx. Package requirements: lucide-react.

What props customize K8s Resource Input?

K8s Resource Input accepts `value`, `defaultValue`, `onValueChange`, `node`, `messages`. Configures kubernetes, k8s, resources requests limits behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of k8s-resource-input?

Node size comes from the node prop; it doesn't query the cluster. Doesn't check LimitRanges, ResourceQuotas or ephemeral storage. QoS class is computed for this container only, not the whole pod Server requirement: backend verification for k8s-resource-input.

How does K8s Resource Input meet accessibility guidelines?

Each field has a visible label and is described by its plain-units readback. aria-invalid on flagged fields; status uses role=status. Focus returns to a nearby control after a fix. Minimizes errors: kubernetes cpu limit wrong unit, 400m memory means bytes.

Which components pair with K8s Resource Input?