or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

authentication-security.mdcluster-configuration.mdcluster-management.mdindex.mdnode-pool-operations.mdoperations-management.md

cluster-configuration.mddocs/

0

# Cluster Configuration

1

2

Advanced cluster configuration management for Google Kubernetes Engine. This module provides comprehensive functionality for configuring cluster addons, networking, security, logging, monitoring, and maintenance policies.

3

4

## Capabilities

5

6

### Addons Configuration

7

8

Configure cluster addons including HTTP load balancing, horizontal pod autoscaling, Kubernetes dashboard, and network policy enforcement.

9

10

```python { .api }

11

def set_addons_config(

12

self,

13

request=None, *,

14

project_id=None,

15

zone=None,

16

cluster_id=None,

17

addons_config=None,

18

name=None,

19

retry=gapic_v1.method.DEFAULT,

20

timeout=None,

21

metadata=()

22

) -> Operation:

23

"""

24

Sets the addons for a specific cluster.

25

26

Args:

27

project_id (str): Deprecated. The Google Developers Console project ID or project number.

28

zone (str): Deprecated. The name of the Google Compute Engine zone.

29

cluster_id (str): Deprecated. The name of the cluster to upgrade.

30

addons_config (AddonsConfig): Required. The desired configurations for the various addons.

31

name (str): The name (project, location, cluster) of the cluster to set addons.

32

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}

33

retry: Retry configuration.

34

timeout (float): Request timeout in seconds.

35

metadata: Additional gRPC metadata.

36

37

Returns:

38

Operation: An operation representing the addons configuration.

39

"""

40

```

41

42

Usage example:

43

44

```python

45

from google.cloud.container_v1.types import AddonsConfig, HttpLoadBalancing, HorizontalPodAutoscaling, NetworkPolicyConfig

46

47

addons_config = AddonsConfig(

48

http_load_balancing=HttpLoadBalancing(disabled=False),

49

horizontal_pod_autoscaling=HorizontalPodAutoscaling(disabled=False),

50

network_policy_config=NetworkPolicyConfig(disabled=False),

51

dns_cache_config=DnsCacheConfig(enabled=True)

52

)

53

54

operation = client.set_addons_config(

55

project_id="my-project",

56

zone="us-central1-a",

57

cluster_id="my-cluster",

58

addons_config=addons_config

59

)

60

```

61

62

### Logging Service Configuration

63

64

Configure the logging service for cluster and workload logs.

65

66

```python { .api }

67

def set_logging_service(

68

self,

69

request=None, *,

70

project_id=None,

71

zone=None,

72

cluster_id=None,

73

logging_service=None,

74

name=None,

75

retry=gapic_v1.method.DEFAULT,

76

timeout=None,

77

metadata=()

78

) -> Operation:

79

"""

80

Sets the logging service for a specific cluster.

81

82

Args:

83

project_id (str): Deprecated. The Google Developers Console project ID or project number.

84

zone (str): Deprecated. The name of the Google Compute Engine zone.

85

cluster_id (str): Deprecated. The name of the cluster to upgrade.

86

logging_service (str): Required. The logging service the cluster should use to write logs.

87

name (str): The name (project, location, cluster) of the cluster to set logging.

88

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}

89

retry: Retry configuration.

90

timeout (float): Request timeout in seconds.

91

metadata: Additional gRPC metadata.

92

93

Returns:

94

Operation: An operation representing the logging service configuration.

95

"""

96

```

97

98

Usage example:

99

100

```python

101

operation = client.set_logging_service(

102

project_id="my-project",

103

zone="us-central1-a",

104

cluster_id="my-cluster",

105

logging_service="logging.googleapis.com/kubernetes"

106

)

107

```

108

109

### Monitoring Service Configuration

110

111

Configure the monitoring service for cluster metrics and health.

112

113

```python { .api }

114

def set_monitoring_service(

115

self,

116

request=None, *,

117

project_id=None,

118

zone=None,

119

cluster_id=None,

120

monitoring_service=None,

121

name=None,

122

retry=gapic_v1.method.DEFAULT,

123

timeout=None,

124

metadata=()

125

) -> Operation:

126

"""

127

Sets the monitoring service for a specific cluster.

128

129

Args:

130

project_id (str): Deprecated. The Google Developers Console project ID or project number.

131

zone (str): Deprecated. The name of the Google Compute Engine zone.

132

cluster_id (str): Deprecated. The name of the cluster to upgrade.

133

monitoring_service (str): Required. The monitoring service the cluster should use to write metrics.

134

name (str): The name (project, location, cluster) of the cluster to set monitoring.

135

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}

136

retry: Retry configuration.

137

timeout (float): Request timeout in seconds.

138

metadata: Additional gRPC metadata.

139

140

Returns:

141

Operation: An operation representing the monitoring service configuration.

142

"""

143

```

144

145

Usage example:

146

147

```python

148

operation = client.set_monitoring_service(

149

project_id="my-project",

150

zone="us-central1-a",

151

cluster_id="my-cluster",

152

monitoring_service="monitoring.googleapis.com/kubernetes"

153

)

154

```

155

156

### Network Policy Configuration

157

158

Configure network policy enforcement for pod-to-pod communication.

159

160

```python { .api }

161

def set_network_policy(

162

self,

163

request=None, *,

164

project_id=None,

165

zone=None,

166

cluster_id=None,

167

network_policy=None,

168

name=None,

169

retry=gapic_v1.method.DEFAULT,

170

timeout=None,

171

metadata=()

172

) -> Operation:

173

"""

174

Enables or disables Network Policy for a cluster.

175

176

Args:

177

project_id (str): Deprecated. The Google Developers Console project ID or project number.

178

zone (str): Deprecated. The name of the Google Compute Engine zone.

179

cluster_id (str): Deprecated. The name of the cluster.

180

network_policy (NetworkPolicy): Required. Configuration options for the NetworkPolicy feature.

181

name (str): The name (project, location, cluster) of the cluster to set networking policy.

182

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}

183

retry: Retry configuration.

184

timeout (float): Request timeout in seconds.

185

metadata: Additional gRPC metadata.

186

187

Returns:

188

Operation: An operation representing the network policy configuration.

189

"""

190

```

191

192

Usage example:

193

194

```python

195

from google.cloud.container_v1.types import NetworkPolicy

196

197

network_policy = NetworkPolicy(

198

enabled=True,

199

provider=NetworkPolicy.Provider.CALICO

200

)

201

202

operation = client.set_network_policy(

203

project_id="my-project",

204

zone="us-central1-a",

205

cluster_id="my-cluster",

206

network_policy=network_policy

207

)

208

```

209

210

### Labels Configuration

211

212

Set or update cluster labels for organization and billing.

213

214

```python { .api }

215

def set_labels(

216

self,

217

request=None, *,

218

project_id=None,

219

zone=None,

220

cluster_id=None,

221

resource_labels=None,

222

label_fingerprint=None,

223

name=None,

224

retry=gapic_v1.method.DEFAULT,

225

timeout=None,

226

metadata=()

227

) -> Operation:

228

"""

229

Sets labels on a cluster.

230

231

Args:

232

project_id (str): Deprecated. The Google Developers Console project ID or project number.

233

zone (str): Deprecated. The name of the Google Compute Engine zone.

234

cluster_id (str): Deprecated. The name of the cluster.

235

resource_labels (MutableMapping[str, str]): Required. The labels to set for that cluster.

236

label_fingerprint (str): Required. The fingerprint of the previous set of labels for this resource.

237

name (str): The name (project, location, cluster) of the cluster to set labels.

238

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}

239

retry: Retry configuration.

240

timeout (float): Request timeout in seconds.

241

metadata: Additional gRPC metadata.

242

243

Returns:

244

Operation: An operation representing the labels configuration.

245

"""

246

```

247

248

Usage example:

249

250

```python

251

labels = {

252

"environment": "production",

253

"team": "platform",

254

"cost-center": "engineering"

255

}

256

257

operation = client.set_labels(

258

project_id="my-project",

259

zone="us-central1-a",

260

cluster_id="my-cluster",

261

resource_labels=labels,

262

label_fingerprint=cluster.label_fingerprint

263

)

264

```

265

266

### Legacy ABAC Configuration

267

268

Configure legacy Attribute-Based Access Control (deprecated).

269

270

```python { .api }

271

def set_legacy_abac(

272

self,

273

request=None, *,

274

project_id=None,

275

zone=None,

276

cluster_id=None,

277

enabled=None,

278

name=None,

279

retry=gapic_v1.method.DEFAULT,

280

timeout=None,

281

metadata=()

282

) -> Operation:

283

"""

284

Enables or disables the ABAC authorization mechanism on a cluster.

285

286

Args:

287

project_id (str): Deprecated. The Google Developers Console project ID or project number.

288

zone (str): Deprecated. The name of the Google Compute Engine zone.

289

cluster_id (str): Deprecated. The name of the cluster.

290

enabled (bool): Required. Whether ABAC authorization will be enabled in the cluster.

291

name (str): The name (project, location, cluster) of the cluster to set legacy abac.

292

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}

293

retry: Retry configuration.

294

timeout (float): Request timeout in seconds.

295

metadata: Additional gRPC metadata.

296

297

Returns:

298

Operation: An operation representing the ABAC configuration.

299

"""

300

```

301

302

### Maintenance Policy Configuration

303

304

Configure cluster maintenance windows and policies.

305

306

```python { .api }

307

def set_maintenance_policy(

308

self,

309

request=None, *,

310

project_id=None,

311

zone=None,

312

cluster_id=None,

313

maintenance_policy=None,

314

name=None,

315

retry=gapic_v1.method.DEFAULT,

316

timeout=None,

317

metadata=()

318

) -> Operation:

319

"""

320

Sets the maintenance policy for a cluster.

321

322

Args:

323

project_id (str): Deprecated. The Google Developers Console project ID or project number.

324

zone (str): Deprecated. The name of the Google Compute Engine zone.

325

cluster_id (str): Deprecated. The name of the cluster to update.

326

maintenance_policy (MaintenancePolicy): Required. The maintenance policy to be set for the cluster.

327

name (str): The name (project, location, cluster) of the cluster to set maintenance policy.

328

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}

329

retry: Retry configuration.

330

timeout (float): Request timeout in seconds.

331

metadata: Additional gRPC metadata.

332

333

Returns:

334

Operation: An operation representing the maintenance policy configuration.

335

"""

336

```

337

338

Usage example:

339

340

```python

341

from google.cloud.container_v1.types import MaintenancePolicy, MaintenanceWindow, DailyMaintenanceWindow

342

343

maintenance_policy = MaintenancePolicy(

344

window=MaintenanceWindow(

345

daily_maintenance_window=DailyMaintenanceWindow(

346

start_time="02:00",

347

duration="PT4H"

348

)

349

)

350

)

351

352

operation = client.set_maintenance_policy(

353

project_id="my-project",

354

zone="us-central1-a",

355

cluster_id="my-cluster",

356

maintenance_policy=maintenance_policy

357

)

358

```

359

360

### Master Version Updates

361

362

Update the Kubernetes master version.

363

364

```python { .api }

365

def update_master(

366

self,

367

request=None, *,

368

project_id=None,

369

zone=None,

370

cluster_id=None,

371

master_version=None,

372

name=None,

373

retry=gapic_v1.method.DEFAULT,

374

timeout=None,

375

metadata=()

376

) -> Operation:

377

"""

378

Updates the master for a specific cluster.

379

380

Args:

381

project_id (str): Deprecated. The Google Developers Console project ID or project number.

382

zone (str): Deprecated. The name of the Google Compute Engine zone.

383

cluster_id (str): Deprecated. The name of the cluster to upgrade.

384

master_version (str): Required. The Kubernetes version to change the master to.

385

name (str): The name (project, location, cluster) of the cluster to update.

386

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}

387

retry: Retry configuration.

388

timeout (float): Request timeout in seconds.

389

metadata: Additional gRPC metadata.

390

391

Returns:

392

Operation: An operation representing the master update.

393

"""

394

```

395

396

Usage example:

397

398

```python

399

operation = client.update_master(

400

project_id="my-project",

401

zone="us-central1-a",

402

cluster_id="my-cluster",

403

master_version="1.21.14-gke.700"

404

)

405

```

406

407

### Location Configuration

408

409

Set the locations where cluster nodes can be placed.

410

411

```python { .api }

412

def set_locations(

413

self,

414

request=None, *,

415

project_id=None,

416

zone=None,

417

cluster_id=None,

418

locations=None,

419

name=None,

420

retry=gapic_v1.method.DEFAULT,

421

timeout=None,

422

metadata=()

423

) -> Operation:

424

"""

425

Sets the locations for a specific cluster. Deprecated.

426

427

Args:

428

project_id (str): Deprecated. The Google Developers Console project ID or project number.

429

zone (str): Deprecated. The name of the Google Compute Engine zone.

430

cluster_id (str): Deprecated. The name of the cluster to upgrade.

431

locations (MutableSequence[str]): Required. The desired list of Google Compute Engine zones.

432

name (str): The name (project, location, cluster) of the cluster to set locations.

433

Format: projects/{project_id}/locations/{location}/clusters/{cluster_id}

434

retry: Retry configuration.

435

timeout (float): Request timeout in seconds.

436

metadata: Additional gRPC metadata.

437

438

Returns:

439

Operation: An operation representing the location configuration.

440

"""

441

```

442

443

## Types

444

445

```python { .api }

446

class SetAddonsConfigRequest:

447

"""SetAddonsConfigRequest sets the addons associated with the cluster."""

448

project_id: str # Deprecated

449

zone: str # Deprecated

450

cluster_id: str # Deprecated

451

addons_config: AddonsConfig # Required

452

name: str # Required

453

454

class SetLoggingServiceRequest:

455

"""SetLoggingServiceRequest sets the logging service of a cluster."""

456

project_id: str # Deprecated

457

zone: str # Deprecated

458

cluster_id: str # Deprecated

459

logging_service: str # Required

460

name: str # Required

461

462

class SetMonitoringServiceRequest:

463

"""SetMonitoringServiceRequest sets the monitoring service of a cluster."""

464

project_id: str # Deprecated

465

zone: str # Deprecated

466

cluster_id: str # Deprecated

467

monitoring_service: str # Required

468

name: str # Required

469

470

class SetNetworkPolicyRequest:

471

"""SetNetworkPolicyRequest enables/disables network policy for a cluster."""

472

project_id: str # Deprecated

473

zone: str # Deprecated

474

cluster_id: str # Deprecated

475

network_policy: NetworkPolicy # Required

476

name: str # Required

477

478

class SetLabelsRequest:

479

"""SetLabelsRequest sets the Google Cloud Platform labels on a Google Container Engine cluster."""

480

project_id: str # Deprecated

481

zone: str # Deprecated

482

cluster_id: str # Deprecated

483

resource_labels: MutableMapping[str, str] # Required

484

label_fingerprint: str # Required

485

name: str # Required

486

487

class SetLegacyAbacRequest:

488

"""SetLegacyAbacRequest enables or disables the ABAC authorization mechanism."""

489

project_id: str # Deprecated

490

zone: str # Deprecated

491

cluster_id: str # Deprecated

492

enabled: bool # Required

493

name: str # Required

494

495

class SetMaintenancePolicyRequest:

496

"""SetMaintenancePolicyRequest sets the maintenance policy for a cluster."""

497

project_id: str # Deprecated

498

zone: str # Deprecated

499

cluster_id: str # Deprecated

500

maintenance_policy: MaintenancePolicy # Required

501

name: str # Required

502

503

class UpdateMasterRequest:

504

"""UpdateMasterRequest updates the master of the cluster."""

505

project_id: str # Deprecated

506

zone: str # Deprecated

507

cluster_id: str # Deprecated

508

master_version: str # Required

509

name: str # Required

510

511

class SetLocationsRequest:

512

"""SetLocationsRequest sets the locations of the cluster."""

513

project_id: str # Deprecated

514

zone: str # Deprecated

515

cluster_id: str # Deprecated

516

locations: MutableSequence[str] # Required

517

name: str # Required

518

519

class AddonsConfig:

520

"""Configuration for the addons that can be automatically spun up in the cluster."""

521

http_load_balancing: HttpLoadBalancing

522

horizontal_pod_autoscaling: HorizontalPodAutoscaling

523

kubernetes_dashboard: KubernetesDashboard

524

network_policy_config: NetworkPolicyConfig

525

dns_cache_config: DnsCacheConfig

526

config_connector_config: ConfigConnectorConfig

527

gce_persistent_disk_csi_driver_config: GcePersistentDiskCsiDriverConfig

528

gcp_filestore_csi_driver_config: GcpFilestoreCsiDriverConfig

529

gcs_fuse_csi_driver_config: GcsFuseCsiDriverConfig

530

cloud_run_config: CloudRunConfig

531

gke_backup_agent_config: GkeBackupAgentConfig

532

stateful_ha_config: StatefulHAConfig

533

ray_operator_config: RayOperatorConfig

534

535

class NetworkPolicy:

536

"""Configuration for NetworkPolicy. This only tracks whether the addon is enabled or not."""

537

provider: NetworkPolicy.Provider

538

enabled: bool

539

540

class Provider(proto.Enum):

541

"""The set of available providers."""

542

PROVIDER_UNSPECIFIED = 0

543

CALICO = 1

544

545

class MaintenancePolicy:

546

"""MaintenancePolicy defines the maintenance policy to be used for the cluster."""

547

window: MaintenanceWindow

548

resource_version: str

549

550

class MaintenanceWindow:

551

"""MaintenanceWindow defines the maintenance window to be used for the cluster."""

552

daily_maintenance_window: DailyMaintenanceWindow

553

recurring_window: RecurringTimeWindow

554

maintenance_exclusions: MutableMapping[str, TimeWindow]

555

556

class DailyMaintenanceWindow:

557

"""Time window specified for daily maintenance operations."""

558

start_time: str

559

duration: str

560

```