Skip to content

Commit b1824b2

Browse files
author
Egor Ermolov
committed
Add OS Login and enviroment fields to dataproc create cluster wrapper.
Committer: Egor Ermolov [email protected]
1 parent 55f44ed commit b1824b2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

yandexcloud/_wrappers/dataproc/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def create_cluster(
6868
services=None,
6969
zone="ru-central1-b",
7070
service_account_id=None,
71+
environment=None,
7172
masternode_resource_preset=None,
7273
masternode_disk_size=None,
7374
masternode_disk_type=None,
@@ -92,6 +93,7 @@ def create_cluster(
9293
host_group_ids=None,
9394
security_group_ids=None,
9495
initialization_actions=None,
96+
oslogin_enabled=False,
9597
labels=None,
9698
):
9799
"""
@@ -121,6 +123,8 @@ def create_cluster(
121123
:param service_account_id: Service account id for the cluster.
122124
Service account can be created inside the folder.
123125
:type service_account_id: str
126+
:param environment: Environment for the cluster. Possible options: PRODUCTION, PRESTABLE.
127+
:type environment: str
124128
:param masternode_resource_preset: Resources preset (CPU+RAM configuration)
125129
for the master node of the cluster.
126130
:type masternode_resource_preset: str
@@ -182,6 +186,8 @@ def create_cluster(
182186
:type security_group_ids: Iterable[str] | None
183187
:param initialization_actions: Set of init-actions to run when cluster starts
184188
:type initialization_actions: Iterable[InitializationAction] | None
189+
:param oslogin_enabled: Enable authorization via OS Login for cluster.
190+
:type oslogin_enabled: bool
185191
:param labels: Cluster labels as key:value pairs. No more than 64 per resource.
186192
:type labels: Dict[str, str]
187193
@@ -208,11 +214,11 @@ def create_cluster(
208214
if not service_account_id:
209215
service_account_id = self.sdk.helpers.find_service_account_id(folder_id)
210216

211-
if not ssh_public_keys:
217+
if not ssh_public_keys and not oslogin_enabled:
212218
if self.default_public_ssh_key:
213219
ssh_public_keys = (self.default_public_ssh_key,)
214220
else:
215-
raise RuntimeError("Public ssh keys must be specified.")
221+
raise RuntimeError("Public ssh keys must be specified or OS Login must be enabled.")
216222
elif isinstance(ssh_public_keys, str):
217223
ssh_public_keys = [ssh_public_keys]
218224

@@ -293,11 +299,13 @@ def create_cluster(
293299
if initialization_actions
294300
else None
295301
),
302+
oslogin_enabled=oslogin_enabled,
296303
),
297304
subclusters_spec=subclusters,
298305
),
299306
zone_id=zone,
300307
service_account_id=service_account_id,
308+
environment=environment,
301309
bucket=s3_bucket,
302310
ui_proxy=enable_ui_proxy,
303311
host_group_ids=host_group_ids,

0 commit comments

Comments
 (0)