Skip to content

fix(vks): validate network-type and auto-healing constraints found in real API calls#42

Merged
vks-team merged 1 commit into
mainfrom
fix/create-cluster-validation
Jul 7, 2026
Merged

fix(vks): validate network-type and auto-healing constraints found in real API calls#42
vks-team merged 1 commit into
mainfrom
fix/create-cluster-validation

Conversation

@vks-team

@vks-team vks-team commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Four constraints the VKS API enforces at create/config time but the CLI never surfaced — each only observable with a real API call, not --dry-run.

Findings & fixes

  1. Auto-healing help example was wrong. --auto-healing-config example showed both maxUnhealthy and unhealthyRange, but the API accepts exactly one. Fixed the example and now reject both together (create-cluster and config-auto-healing).
  2. Dry-run gave false confidence. It reported "valid" for a --k8s-version / --release-channel combo that the server then rejects with Not found version. Dry-run can't reach the versions endpoint, so it now explicitly states it performs local checks only — version/channel compatibility, VPC/subnet existence, and quota are server-validated.
  3. CILIUM_NATIVE_ROUTING requires --node-netmask-size — was not marked. Now validated client-side (dry-run and real create) and documented.
  4. CILIUM_NATIVE_ROUTING requires ≥1 --secondary-subnets — was not marked. Same treatment.

The spec's networkType description confirms 3 & 4: "If you choose CILIUM_NATIVE_ROUTING, you need to set the secondarySubnets and nodeNetmaskSize field."

Changes

  • create_cluster.go: new validateNetworkRequirements (CIDR for TIGERA/CILIUM_OVERLAY; node-netmask + secondary subnets for CILIUM_NATIVE_ROUTING), run on both dry-run and real create; auto-healing exactly-one guard; dry-run disclaimer; help text on --network-type, --node-netmask-size, --secondary-subnets, --auto-healing-config.
  • config_auto_healing.go: reject --max-unhealthy + --unhealthy-range together.
  • builders_test.go: table test for validateNetworkRequirements.
  • Docs: create-cluster.md, config-auto-healing.md updated (conditional-required markers, mutually-exclusive notes, corrected examples).

Verify

go vet ./..., full test suite (-linkmode=external), and CGO_ENABLED=0 go build all pass. Manually confirmed all four behaviors via --dry-run.

… real API calls

Four constraints the API enforces but the CLI didn't surface:

- CILIUM_NATIVE_ROUTING requires --node-netmask-size and at least one
  --secondary-subnets. Now validated client-side (dry-run and real create)
  instead of failing with an opaque server error; help text marks them.
- Auto-healing accepts exactly one of maxUnhealthy / unhealthyRange, not
  both. Enforced in create-cluster (--auto-healing-config) and
  config-auto-healing; fixed the help example that showed both.
- Dry-run now states it does local checks only: version/release-channel
  compatibility, VPC/subnet existence and quota are server-validated, so a
  "valid" dry-run no longer implies the create will succeed.
@vks-team vks-team merged commit 810afee into main Jul 7, 2026
6 checks passed
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