Skip to content

doks: add isolated workers to kubernetes create call - #1069

Merged
DO-rrao merged 2 commits into
digitalocean:mainfrom
varshavaradarajan:varsha/add-isolated-workers
Jul 29, 2026
Merged

doks: add isolated workers to kubernetes create call#1069
DO-rrao merged 2 commits into
digitalocean:mainfrom
varshavaradarajan:varsha/add-isolated-workers

Conversation

@varshavaradarajan

@varshavaradarajan varshavaradarajan commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

This PR adds a new configuration field to kubernetes cluster create call for isolated workers.

@DO-rrao

DO-rrao commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

omitempty makes isolated_workers: false impossible to send

IsolatedWorkers bool `json:"isolated_workers,omitempty"`

Because omitempty drops zero values, this field is only ever included in the request when it's true. A caller can never send isolated_workers: false explicitly — the API just sees the field as absent.

That's only safe if the server treats "absent" and "false" identically at create time. If it ever needs to tell them apart (say, to let false override a VPC- or account-level default), this will silently break.

The struct already handles this exact case a few lines above with HA *bool. I'd suggest matching that pattern and using *bool here, unless we're confident the flag is permanently create-only and always defaults to false. Could you confirm the intended server-side semantics?

@DO-rrao

DO-rrao commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

The field needs a doc comment explaining the NAT-gateway requirement

Isolated workers require the cluster's VPC to already have a NAT gateway attached. I confirmed this against the live API — without one, the create call fails:

422 validation error: isolated workers require a NAT GW to be added to the vpc

As written, the field is undocumented, so the only way a user learns about this precondition is by triggering the 422. A brief comment would make the constraint discoverable at the call site:

// IsolatedWorkers enables isolated worker nodes. When true, the cluster's VPC
// must already have a NAT gateway attached, or the create request fails with a
// 422. This can only be set at creation time.

If isolated workers can actually be changed after creation, drop the last line and add the field to KubernetesClusterUpdateRequest as well (noted separately).

@varshavaradarajan

Copy link
Copy Markdown
Contributor Author

@DO-rrao - thanks for the review.

  1. omitempty makes isolated_workers: false impossible to send : the feature is to start using networkingV2 for doks workers, which only assigns private IPs (not public IPs) to worker nodes. If isolated_workers: false is omitted at creation time, it means isolated_workers is set to false. So, I don't think we should make provisions to explicitly send isolated_workers as false.

  2. Added the comment for the NAT GW pre-requisite. We're gonna document that pre-req for private preview. PTAL. The field is only for create, and cannot be updated. Hence, omitted on KubernetesUpdateClusterRequest.

@DO-rrao DO-rrao left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@DO-rrao
DO-rrao merged commit 107d735 into digitalocean:main Jul 29, 2026
8 checks passed
@varshavaradarajan
varshavaradarajan deleted the varsha/add-isolated-workers branch July 29, 2026 14:30
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