Skip to content

Commit dc737c7

Browse files
committed
Making CloudDNS optional for Pathways-enabled clusters.
1 parent d88b092 commit dc737c7

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,14 @@ all zones.
180180
--num-slices=4 --on-demand \
181181
--tpu-type=v5litepod-16
182182
```
183+
Please specify `--enable-clouddns` if you would like CloudDNS to be the
184+
DNS provider for the Pathways cluster. For example,
185+
```shell
186+
python3 xpk.py cluster create-pathways \
187+
--cluster xpk-pw-test-clouddns \
188+
--num-slices=4 --on-demand \
189+
--tpu-type=v5litepod-16
190+
```
183191

184192
* Cluster Create can be called again with the same `--cluster name` to modify
185193
the number of slices or retry failed steps.

src/xpk/commands/cluster.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def cluster_create(args) -> None:
8888
xpk_exit(create_cluster_command_code)
8989

9090
# Update Pathways clusters with CloudDNS if not enabled already.
91-
if args.enable_pathways:
91+
if args.enable_pathways and args.enable_clouddns:
9292
update_cluster_command_code = update_cluster_with_clouddns_if_necessary(
9393
args
9494
)
@@ -467,11 +467,15 @@ def run_gke_cluster_create_command(
467467
if args.enable_pathways:
468468
command += (
469469
' --enable-ip-alias'
470-
f' --create-subnetwork name={args.cluster}-subnetwork'
470+
f' --create-subnetwork name={args.cluster}-subnetwork')
471+
if args.enable_clouddns:
472+
# Enables CloudDNS as the default provider of the Pathways cluster,
473+
# useful for Pathways headless mode workloads.
474+
command += (
471475
' --cluster-dns=clouddns'
472476
' --cluster-dns-scope=vpc'
473477
f' --cluster-dns-domain={args.cluster}-domain'
474-
)
478+
)
475479

476480
return_code = run_command_with_updates(command, 'GKE Cluster Create', args)
477481
if return_code != 0:

src/xpk/commands/workload.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,9 @@ def workload_create(args) -> None:
326326

327327
if args.headless and not is_cluster_using_clouddns(args):
328328
xpk_print(
329-
'Please run xpk cluster create-pathways first, to upgrade and enable'
330-
' CloudDNS on your cluster.'
329+
'Cluster is not using CloudDNS, connect to the proxy server'
330+
' using kubectl port forwarding. '
331331
)
332-
xpk_exit(1)
333332

334333
set_cluster_command_code = set_cluster_command(args)
335334
if set_cluster_command_code != 0:

src/xpk/parser/cluster.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ def set_cluster_parser(cluster_parser):
168168
default=None,
169169
help='The tpu type to use, v5litepod-16, etc.',
170170
)
171+
cluster_create_pathways_optional_arguments.add_argument(
172+
'--enable-clouddns',
173+
type=bool,
174+
default=False,
175+
help='Enables CloudDNS on the Pathways cluster.',
176+
)
171177

172178
add_shared_cluster_create_required_arguments([
173179
cluster_create_required_arguments,

src/xpk/parser/workload.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,8 @@ def add_shared_workload_create_optional_arguments(args_parsers):
521521
' headless mode. This arg can only be used in `xpk workload'
522522
' create-pathways`(preferred) or `xpk workload create'
523523
' --use-pathways.` (--use-pathways will be deprecated soon).'
524+
' Headless workloads may be created on clusters with/without '
525+
' CloudDNS.'
524526
),
525527
)
526528
custom_parser.add_argument(

0 commit comments

Comments
 (0)