This repository has been archived by the owner on Nov 29, 2023. It is now read-only.
/
cluster_service.py
3783 lines (3334 loc) · 156 KB
/
cluster_service.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import proto # type: ignore
from google.protobuf import timestamp_pb2 # type: ignore
__protobuf__ = proto.module(
package="google.container.v1",
manifest={
"NodeConfig",
"ShieldedInstanceConfig",
"SandboxConfig",
"ReservationAffinity",
"NodeTaint",
"MasterAuth",
"ClientCertificateConfig",
"AddonsConfig",
"HttpLoadBalancing",
"HorizontalPodAutoscaling",
"KubernetesDashboard",
"NetworkPolicyConfig",
"DnsCacheConfig",
"PrivateClusterMasterGlobalAccessConfig",
"PrivateClusterConfig",
"AuthenticatorGroupsConfig",
"CloudRunConfig",
"ConfigConnectorConfig",
"MasterAuthorizedNetworksConfig",
"LegacyAbac",
"NetworkPolicy",
"BinaryAuthorization",
"IPAllocationPolicy",
"Cluster",
"ClusterUpdate",
"Operation",
"OperationProgress",
"CreateClusterRequest",
"GetClusterRequest",
"UpdateClusterRequest",
"UpdateNodePoolRequest",
"SetNodePoolAutoscalingRequest",
"SetLoggingServiceRequest",
"SetMonitoringServiceRequest",
"SetAddonsConfigRequest",
"SetLocationsRequest",
"UpdateMasterRequest",
"SetMasterAuthRequest",
"DeleteClusterRequest",
"ListClustersRequest",
"ListClustersResponse",
"GetOperationRequest",
"ListOperationsRequest",
"CancelOperationRequest",
"ListOperationsResponse",
"GetServerConfigRequest",
"ServerConfig",
"CreateNodePoolRequest",
"DeleteNodePoolRequest",
"ListNodePoolsRequest",
"GetNodePoolRequest",
"NodePool",
"NodeManagement",
"AutoUpgradeOptions",
"MaintenancePolicy",
"MaintenanceWindow",
"TimeWindow",
"RecurringTimeWindow",
"DailyMaintenanceWindow",
"SetNodePoolManagementRequest",
"SetNodePoolSizeRequest",
"RollbackNodePoolUpgradeRequest",
"ListNodePoolsResponse",
"ClusterAutoscaling",
"AutoprovisioningNodePoolDefaults",
"ResourceLimit",
"NodePoolAutoscaling",
"SetLabelsRequest",
"SetLegacyAbacRequest",
"StartIPRotationRequest",
"CompleteIPRotationRequest",
"AcceleratorConfig",
"WorkloadMetadataConfig",
"SetNetworkPolicyRequest",
"SetMaintenancePolicyRequest",
"StatusCondition",
"NetworkConfig",
"GetOpenIDConfigRequest",
"GetOpenIDConfigResponse",
"GetJSONWebKeysRequest",
"Jwk",
"GetJSONWebKeysResponse",
"ReleaseChannel",
"IntraNodeVisibilityConfig",
"MaxPodsConstraint",
"WorkloadIdentityConfig",
"DatabaseEncryption",
"ListUsableSubnetworksRequest",
"ListUsableSubnetworksResponse",
"UsableSubnetworkSecondaryRange",
"UsableSubnetwork",
"ResourceUsageExportConfig",
"VerticalPodAutoscaling",
"DefaultSnatStatus",
"ShieldedNodes",
},
)
class NodeConfig(proto.Message):
r"""Parameters that describe the nodes in a cluster.
Attributes:
machine_type (str):
The name of a Google Compute Engine `machine
type <https://cloud.google.com/compute/docs/machine-types>`__
If unspecified, the default machine type is ``e2-medium``.
disk_size_gb (int):
Size of the disk attached to each node,
specified in GB. The smallest allowed disk size
is 10GB.
If unspecified, the default disk size is 100GB.
oauth_scopes (Sequence[str]):
The set of Google API scopes to be made available on all of
the node VMs under the "default" service account.
The following scopes are recommended, but not required, and
by default are not included:
- ``https://www.googleapis.com/auth/compute`` is required
for mounting persistent storage on your nodes.
- ``https://www.googleapis.com/auth/devstorage.read_only``
is required for communicating with **gcr.io** (the
`Google Container
Registry <https://cloud.google.com/container-registry/>`__).
If unspecified, no scopes are added, unless Cloud Logging or
Cloud Monitoring are enabled, in which case their required
scopes will be added.
service_account (str):
The Google Cloud Platform Service Account to
be used by the node VMs. Specify the email
address of the Service Account; otherwise, if no
Service Account is specified, the "default"
service account is used.
metadata (Sequence[google.cloud.container_v1.types.NodeConfig.MetadataEntry]):
The metadata key/value pairs assigned to instances in the
cluster.
Keys must conform to the regexp ``[a-zA-Z0-9-_]+`` and be
less than 128 bytes in length. These are reflected as part
of a URL in the metadata server. Additionally, to avoid
ambiguity, keys must not conflict with any other metadata
keys for the project or be one of the reserved keys:
- "cluster-location"
- "cluster-name"
- "cluster-uid"
- "configure-sh"
- "containerd-configure-sh"
- "enable-os-login"
- "gci-ensure-gke-docker"
- "gci-metrics-enabled"
- "gci-update-strategy"
- "instance-template"
- "kube-env"
- "startup-script"
- "user-data"
- "disable-address-manager"
- "windows-startup-script-ps1"
- "common-psm1"
- "k8s-node-setup-psm1"
- "install-ssh-psm1"
- "user-profile-psm1"
The following keys are reserved for Windows nodes:
- "serial-port-logging-enable"
Values are free-form strings, and only have meaning as
interpreted by the image running in the instance. The only
restriction placed on them is that each value's size must be
less than or equal to 32 KB.
The total size of all keys and values must be less than 512
KB.
image_type (str):
The image type to use for this node. Note
that for a given image type, the latest version
of it will be used.
labels (Sequence[google.cloud.container_v1.types.NodeConfig.LabelsEntry]):
The map of Kubernetes labels (key/value
pairs) to be applied to each node. These will
added in addition to any default label(s) that
Kubernetes may apply to the node.
In case of conflict in label keys, the applied
set may differ depending on the Kubernetes
version -- it's best to assume the behavior is
undefined and conflicts should be avoided.
For more information, including usage and the
valid values, see:
https://kubernetes.io/docs/concepts/overview/working-
with-objects/labels/
local_ssd_count (int):
The number of local SSD disks to be attached
to the node.
The limit for this value is dependent upon the
maximum number of disks available on a machine
per zone. See:
https://cloud.google.com/compute/docs/disks/local-
ssd for more information.
tags (Sequence[str]):
The list of instance tags applied to all
nodes. Tags are used to identify valid sources
or targets for network firewalls and are
specified by the client during cluster or node
pool creation. Each tag within the list must
comply with RFC1035.
preemptible (bool):
Whether the nodes are created as preemptible
VM instances. See:
https://cloud.google.com/compute/docs/instances/preemptible
for more information about preemptible VM
instances.
accelerators (Sequence[google.cloud.container_v1.types.AcceleratorConfig]):
A list of hardware accelerators to be
attached to each node. See
https://cloud.google.com/compute/docs/gpus for
more information about support for GPUs.
disk_type (str):
Type of the disk attached to each node (e.g.
'pd-standard', 'pd-ssd' or 'pd-balanced')
If unspecified, the default disk type is 'pd-
standard'
min_cpu_platform (str):
Minimum CPU platform to be used by this instance. The
instance may be scheduled on the specified or newer CPU
platform. Applicable values are the friendly names of CPU
platforms, such as ``minCpuPlatform: "Intel Haswell"`` or
``minCpuPlatform: "Intel Sandy Bridge"``. For more
information, read `how to specify min CPU
platform <https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform>`__
workload_metadata_config (google.cloud.container_v1.types.WorkloadMetadataConfig):
The workload metadata configuration for this
node.
taints (Sequence[google.cloud.container_v1.types.NodeTaint]):
List of kubernetes taints to be applied to
each node.
For more information, including usage and the
valid values, see:
https://kubernetes.io/docs/concepts/configuration/taint-
and-toleration/
sandbox_config (google.cloud.container_v1.types.SandboxConfig):
Sandbox configuration for this node.
node_group (str):
Setting this field will assign instances of this pool to run
on the specified node group. This is useful for running
workloads on `sole tenant
nodes <https://cloud.google.com/compute/docs/nodes/sole-tenant-nodes>`__.
reservation_affinity (google.cloud.container_v1.types.ReservationAffinity):
The optional reservation affinity. Setting this field will
apply the specified `Zonal Compute
Reservation <https://cloud.google.com/compute/docs/instances/reserving-zonal-resources>`__
to this node pool.
shielded_instance_config (google.cloud.container_v1.types.ShieldedInstanceConfig):
Shielded Instance options.
boot_disk_kms_key (str):
The Customer Managed Encryption Key used to encrypt the boot
disk attached to each node in the node pool. This should be
of the form
projects/[KEY_PROJECT_ID]/locations/[LOCATION]/keyRings/[RING_NAME]/cryptoKeys/[KEY_NAME].
For more information about protecting resources with Cloud
KMS Keys please see:
https://cloud.google.com/compute/docs/disks/customer-managed-encryption
"""
machine_type = proto.Field(proto.STRING, number=1,)
disk_size_gb = proto.Field(proto.INT32, number=2,)
oauth_scopes = proto.RepeatedField(proto.STRING, number=3,)
service_account = proto.Field(proto.STRING, number=9,)
metadata = proto.MapField(proto.STRING, proto.STRING, number=4,)
image_type = proto.Field(proto.STRING, number=5,)
labels = proto.MapField(proto.STRING, proto.STRING, number=6,)
local_ssd_count = proto.Field(proto.INT32, number=7,)
tags = proto.RepeatedField(proto.STRING, number=8,)
preemptible = proto.Field(proto.BOOL, number=10,)
accelerators = proto.RepeatedField(
proto.MESSAGE, number=11, message="AcceleratorConfig",
)
disk_type = proto.Field(proto.STRING, number=12,)
min_cpu_platform = proto.Field(proto.STRING, number=13,)
workload_metadata_config = proto.Field(
proto.MESSAGE, number=14, message="WorkloadMetadataConfig",
)
taints = proto.RepeatedField(proto.MESSAGE, number=15, message="NodeTaint",)
sandbox_config = proto.Field(proto.MESSAGE, number=17, message="SandboxConfig",)
node_group = proto.Field(proto.STRING, number=18,)
reservation_affinity = proto.Field(
proto.MESSAGE, number=19, message="ReservationAffinity",
)
shielded_instance_config = proto.Field(
proto.MESSAGE, number=20, message="ShieldedInstanceConfig",
)
boot_disk_kms_key = proto.Field(proto.STRING, number=23,)
class ShieldedInstanceConfig(proto.Message):
r"""A set of Shielded Instance options.
Attributes:
enable_secure_boot (bool):
Defines whether the instance has Secure Boot
enabled.
Secure Boot helps ensure that the system only
runs authentic software by verifying the digital
signature of all boot components, and halting
the boot process if signature verification
fails.
enable_integrity_monitoring (bool):
Defines whether the instance has integrity
monitoring enabled.
Enables monitoring and attestation of the boot
integrity of the instance. The attestation is
performed against the integrity policy baseline.
This baseline is initially derived from the
implicitly trusted boot image when the instance
is created.
"""
enable_secure_boot = proto.Field(proto.BOOL, number=1,)
enable_integrity_monitoring = proto.Field(proto.BOOL, number=2,)
class SandboxConfig(proto.Message):
r"""SandboxConfig contains configurations of the sandbox to use
for the node.
Attributes:
type_ (google.cloud.container_v1.types.SandboxConfig.Type):
Type of the sandbox to use for the node.
"""
class Type(proto.Enum):
r"""Possible types of sandboxes."""
UNSPECIFIED = 0
GVISOR = 1
type_ = proto.Field(proto.ENUM, number=2, enum=Type,)
class ReservationAffinity(proto.Message):
r"""`ReservationAffinity <https://cloud.google.com/compute/docs/instances/reserving-zonal-resources>`__
is the configuration of desired reservation which instances could
take capacity from.
Attributes:
consume_reservation_type (google.cloud.container_v1.types.ReservationAffinity.Type):
Corresponds to the type of reservation
consumption.
key (str):
Corresponds to the label key of a reservation resource. To
target a SPECIFIC_RESERVATION by name, specify
"googleapis.com/reservation-name" as the key and specify the
name of your reservation as its value.
values (Sequence[str]):
Corresponds to the label value(s) of
reservation resource(s).
"""
class Type(proto.Enum):
r"""Indicates whether to consume capacity from a reservation or
not.
"""
UNSPECIFIED = 0
NO_RESERVATION = 1
ANY_RESERVATION = 2
SPECIFIC_RESERVATION = 3
consume_reservation_type = proto.Field(proto.ENUM, number=1, enum=Type,)
key = proto.Field(proto.STRING, number=2,)
values = proto.RepeatedField(proto.STRING, number=3,)
class NodeTaint(proto.Message):
r"""Kubernetes taint is comprised of three fields: key, value, and
effect. Effect can only be one of three types: NoSchedule,
PreferNoSchedule or NoExecute.
See
`here <https://kubernetes.io/docs/concepts/configuration/taint-and-toleration>`__
for more information, including usage and the valid values.
Attributes:
key (str):
Key for taint.
value (str):
Value for taint.
effect (google.cloud.container_v1.types.NodeTaint.Effect):
Effect for taint.
"""
class Effect(proto.Enum):
r"""Possible values for Effect in taint."""
EFFECT_UNSPECIFIED = 0
NO_SCHEDULE = 1
PREFER_NO_SCHEDULE = 2
NO_EXECUTE = 3
key = proto.Field(proto.STRING, number=1,)
value = proto.Field(proto.STRING, number=2,)
effect = proto.Field(proto.ENUM, number=3, enum=Effect,)
class MasterAuth(proto.Message):
r"""The authentication information for accessing the master
endpoint. Authentication can be done using HTTP basic auth or
using client certificates.
Attributes:
username (str):
The username to use for HTTP basic
authentication to the master endpoint. For
clusters v1.6.0 and later, basic authentication
can be disabled by leaving username unspecified
(or setting it to the empty string).
Warning: basic authentication is deprecated, and
will be removed in GKE control plane versions
1.19 and newer. For a list of recommended
authentication methods, see:
https://cloud.google.com/kubernetes-
engine/docs/how-to/api-server-authentication
password (str):
The password to use for HTTP basic
authentication to the master endpoint. Because
the master endpoint is open to the Internet, you
should create a strong password. If a password
is provided for cluster creation, username must
be non-empty.
Warning: basic authentication is deprecated, and
will be removed in GKE control plane versions
1.19 and newer. For a list of recommended
authentication methods, see:
https://cloud.google.com/kubernetes-
engine/docs/how-to/api-server-authentication
client_certificate_config (google.cloud.container_v1.types.ClientCertificateConfig):
Configuration for client certificate
authentication on the cluster. For clusters
before v1.12, if no configuration is specified,
a client certificate is issued.
cluster_ca_certificate (str):
[Output only] Base64-encoded public certificate that is the
root of trust for the cluster.
client_certificate (str):
[Output only] Base64-encoded public certificate used by
clients to authenticate to the cluster endpoint.
client_key (str):
[Output only] Base64-encoded private key used by clients to
authenticate to the cluster endpoint.
"""
username = proto.Field(proto.STRING, number=1,)
password = proto.Field(proto.STRING, number=2,)
client_certificate_config = proto.Field(
proto.MESSAGE, number=3, message="ClientCertificateConfig",
)
cluster_ca_certificate = proto.Field(proto.STRING, number=100,)
client_certificate = proto.Field(proto.STRING, number=101,)
client_key = proto.Field(proto.STRING, number=102,)
class ClientCertificateConfig(proto.Message):
r"""Configuration for client certificates on the cluster.
Attributes:
issue_client_certificate (bool):
Issue a client certificate.
"""
issue_client_certificate = proto.Field(proto.BOOL, number=1,)
class AddonsConfig(proto.Message):
r"""Configuration for the addons that can be automatically spun
up in the cluster, enabling additional functionality.
Attributes:
http_load_balancing (google.cloud.container_v1.types.HttpLoadBalancing):
Configuration for the HTTP (L7) load
balancing controller addon, which makes it easy
to set up HTTP load balancers for services in a
cluster.
horizontal_pod_autoscaling (google.cloud.container_v1.types.HorizontalPodAutoscaling):
Configuration for the horizontal pod
autoscaling feature, which increases or
decreases the number of replica pods a
replication controller has based on the resource
usage of the existing pods.
kubernetes_dashboard (google.cloud.container_v1.types.KubernetesDashboard):
Configuration for the Kubernetes Dashboard.
This addon is deprecated, and will be disabled
in 1.15. It is recommended to use the Cloud
Console to manage and monitor your Kubernetes
clusters, workloads and applications. For more
information, see:
https://cloud.google.com/kubernetes-
engine/docs/concepts/dashboards
network_policy_config (google.cloud.container_v1.types.NetworkPolicyConfig):
Configuration for NetworkPolicy. This only
tracks whether the addon is enabled or not on
the Master, it does not track whether network
policy is enabled for the nodes.
cloud_run_config (google.cloud.container_v1.types.CloudRunConfig):
Configuration for the Cloud Run addon, which
allows the user to use a managed Knative
service.
dns_cache_config (google.cloud.container_v1.types.DnsCacheConfig):
Configuration for NodeLocalDNS, a dns cache
running on cluster nodes
config_connector_config (google.cloud.container_v1.types.ConfigConnectorConfig):
Configuration for the ConfigConnector add-on,
a Kubernetes extension to manage hosted GCP
services through the Kubernetes API
"""
http_load_balancing = proto.Field(
proto.MESSAGE, number=1, message="HttpLoadBalancing",
)
horizontal_pod_autoscaling = proto.Field(
proto.MESSAGE, number=2, message="HorizontalPodAutoscaling",
)
kubernetes_dashboard = proto.Field(
proto.MESSAGE, number=3, message="KubernetesDashboard",
)
network_policy_config = proto.Field(
proto.MESSAGE, number=4, message="NetworkPolicyConfig",
)
cloud_run_config = proto.Field(proto.MESSAGE, number=7, message="CloudRunConfig",)
dns_cache_config = proto.Field(proto.MESSAGE, number=8, message="DnsCacheConfig",)
config_connector_config = proto.Field(
proto.MESSAGE, number=10, message="ConfigConnectorConfig",
)
class HttpLoadBalancing(proto.Message):
r"""Configuration options for the HTTP (L7) load balancing
controller addon, which makes it easy to set up HTTP load
balancers for services in a cluster.
Attributes:
disabled (bool):
Whether the HTTP Load Balancing controller is
enabled in the cluster. When enabled, it runs a
small pod in the cluster that manages the load
balancers.
"""
disabled = proto.Field(proto.BOOL, number=1,)
class HorizontalPodAutoscaling(proto.Message):
r"""Configuration options for the horizontal pod autoscaling
feature, which increases or decreases the number of replica pods
a replication controller has based on the resource usage of the
existing pods.
Attributes:
disabled (bool):
Whether the Horizontal Pod Autoscaling
feature is enabled in the cluster. When enabled,
it ensures that metrics are collected into
Stackdriver Monitoring.
"""
disabled = proto.Field(proto.BOOL, number=1,)
class KubernetesDashboard(proto.Message):
r"""Configuration for the Kubernetes Dashboard.
Attributes:
disabled (bool):
Whether the Kubernetes Dashboard is enabled
for this cluster.
"""
disabled = proto.Field(proto.BOOL, number=1,)
class NetworkPolicyConfig(proto.Message):
r"""Configuration for NetworkPolicy. This only tracks whether the
addon is enabled or not on the Master, it does not track whether
network policy is enabled for the nodes.
Attributes:
disabled (bool):
Whether NetworkPolicy is enabled for this
cluster.
"""
disabled = proto.Field(proto.BOOL, number=1,)
class DnsCacheConfig(proto.Message):
r"""Configuration for NodeLocal DNSCache
Attributes:
enabled (bool):
Whether NodeLocal DNSCache is enabled for
this cluster.
"""
enabled = proto.Field(proto.BOOL, number=1,)
class PrivateClusterMasterGlobalAccessConfig(proto.Message):
r"""Configuration for controlling master global access settings.
Attributes:
enabled (bool):
Whenever master is accessible globally or
not.
"""
enabled = proto.Field(proto.BOOL, number=1,)
class PrivateClusterConfig(proto.Message):
r"""Configuration options for private clusters.
Attributes:
enable_private_nodes (bool):
Whether nodes have internal IP addresses
only. If enabled, all nodes are given only RFC
1918 private addresses and communicate with the
master via private networking.
enable_private_endpoint (bool):
Whether the master's internal IP address is
used as the cluster endpoint.
master_ipv4_cidr_block (str):
The IP range in CIDR notation to use for the
hosted master network. This range will be used
for assigning internal IP addresses to the
master or set of masters, as well as the ILB
VIP. This range must not overlap with any other
ranges in use within the cluster's network.
private_endpoint (str):
Output only. The internal IP address of this
cluster's master endpoint.
public_endpoint (str):
Output only. The external IP address of this
cluster's master endpoint.
peering_name (str):
Output only. The peering name in the customer
VPC used by this cluster.
master_global_access_config (google.cloud.container_v1.types.PrivateClusterMasterGlobalAccessConfig):
Controls master global access settings.
"""
enable_private_nodes = proto.Field(proto.BOOL, number=1,)
enable_private_endpoint = proto.Field(proto.BOOL, number=2,)
master_ipv4_cidr_block = proto.Field(proto.STRING, number=3,)
private_endpoint = proto.Field(proto.STRING, number=4,)
public_endpoint = proto.Field(proto.STRING, number=5,)
peering_name = proto.Field(proto.STRING, number=7,)
master_global_access_config = proto.Field(
proto.MESSAGE, number=8, message="PrivateClusterMasterGlobalAccessConfig",
)
class AuthenticatorGroupsConfig(proto.Message):
r"""Configuration for returning group information from
authenticators.
Attributes:
enabled (bool):
Whether this cluster should return group
membership lookups during authentication using a
group of security groups.
security_group (str):
The name of the security group-of-groups to
be used. Only relevant if enabled = true.
"""
enabled = proto.Field(proto.BOOL, number=1,)
security_group = proto.Field(proto.STRING, number=2,)
class CloudRunConfig(proto.Message):
r"""Configuration options for the Cloud Run feature.
Attributes:
disabled (bool):
Whether Cloud Run addon is enabled for this
cluster.
load_balancer_type (google.cloud.container_v1.types.CloudRunConfig.LoadBalancerType):
Which load balancer type is installed for
Cloud Run.
"""
class LoadBalancerType(proto.Enum):
r"""Load balancer type of ingress service of Cloud Run."""
LOAD_BALANCER_TYPE_UNSPECIFIED = 0
LOAD_BALANCER_TYPE_EXTERNAL = 1
LOAD_BALANCER_TYPE_INTERNAL = 2
disabled = proto.Field(proto.BOOL, number=1,)
load_balancer_type = proto.Field(proto.ENUM, number=3, enum=LoadBalancerType,)
class ConfigConnectorConfig(proto.Message):
r"""Configuration options for the Config Connector add-on.
Attributes:
enabled (bool):
Whether Cloud Connector is enabled for this
cluster.
"""
enabled = proto.Field(proto.BOOL, number=1,)
class MasterAuthorizedNetworksConfig(proto.Message):
r"""Configuration options for the master authorized networks
feature. Enabled master authorized networks will disallow all
external traffic to access Kubernetes master through HTTPS
except traffic from the given CIDR blocks, Google Compute Engine
Public IPs and Google Prod IPs.
Attributes:
enabled (bool):
Whether or not master authorized networks is
enabled.
cidr_blocks (Sequence[google.cloud.container_v1.types.MasterAuthorizedNetworksConfig.CidrBlock]):
cidr_blocks define up to 50 external networks that could
access Kubernetes master through HTTPS.
"""
class CidrBlock(proto.Message):
r"""CidrBlock contains an optional name and one CIDR block.
Attributes:
display_name (str):
display_name is an optional field for users to identify CIDR
blocks.
cidr_block (str):
cidr_block must be specified in CIDR notation.
"""
display_name = proto.Field(proto.STRING, number=1,)
cidr_block = proto.Field(proto.STRING, number=2,)
enabled = proto.Field(proto.BOOL, number=1,)
cidr_blocks = proto.RepeatedField(proto.MESSAGE, number=2, message=CidrBlock,)
class LegacyAbac(proto.Message):
r"""Configuration for the legacy Attribute Based Access Control
authorization mode.
Attributes:
enabled (bool):
Whether the ABAC authorizer is enabled for
this cluster. When enabled, identities in the
system, including service accounts, nodes, and
controllers, will have statically granted
permissions beyond those provided by the RBAC
configuration or IAM.
"""
enabled = proto.Field(proto.BOOL, number=1,)
class NetworkPolicy(proto.Message):
r"""Configuration options for the NetworkPolicy feature.
https://kubernetes.io/docs/concepts/services-
networking/networkpolicies/
Attributes:
provider (google.cloud.container_v1.types.NetworkPolicy.Provider):
The selected network policy provider.
enabled (bool):
Whether network policy is enabled on the
cluster.
"""
class Provider(proto.Enum):
r"""Allowed Network Policy providers."""
PROVIDER_UNSPECIFIED = 0
CALICO = 1
provider = proto.Field(proto.ENUM, number=1, enum=Provider,)
enabled = proto.Field(proto.BOOL, number=2,)
class BinaryAuthorization(proto.Message):
r"""Configuration for Binary Authorization.
Attributes:
enabled (bool):
Enable Binary Authorization for this cluster.
If enabled, all container images will be
validated by Binary Authorization.
"""
enabled = proto.Field(proto.BOOL, number=1,)
class IPAllocationPolicy(proto.Message):
r"""Configuration for controlling how IPs are allocated in the
cluster.
Attributes:
use_ip_aliases (bool):
Whether alias IPs will be used for pod IPs in the cluster.
This is used in conjunction with use_routes. It cannot be
true if use_routes is true. If both use_ip_aliases and
use_routes are false, then the server picks the default IP
allocation mode
create_subnetwork (bool):
Whether a new subnetwork will be created automatically for
the cluster.
This field is only applicable when ``use_ip_aliases`` is
true.
subnetwork_name (str):
A custom subnetwork name to be used if ``create_subnetwork``
is true. If this field is empty, then an automatic name will
be chosen for the new subnetwork.
cluster_ipv4_cidr (str):
This field is deprecated, use cluster_ipv4_cidr_block.
node_ipv4_cidr (str):
This field is deprecated, use node_ipv4_cidr_block.
services_ipv4_cidr (str):
This field is deprecated, use services_ipv4_cidr_block.
cluster_secondary_range_name (str):
The name of the secondary range to be used for the cluster
CIDR block. The secondary range will be used for pod IP
addresses. This must be an existing secondary range
associated with the cluster subnetwork.
This field is only applicable with use_ip_aliases is true
and create_subnetwork is false.
services_secondary_range_name (str):
The name of the secondary range to be used as for the
services CIDR block. The secondary range will be used for
service ClusterIPs. This must be an existing secondary range
associated with the cluster subnetwork.
This field is only applicable with use_ip_aliases is true
and create_subnetwork is false.
cluster_ipv4_cidr_block (str):
The IP address range for the cluster pod IPs. If this field
is set, then ``cluster.cluster_ipv4_cidr`` must be left
blank.
This field is only applicable when ``use_ip_aliases`` is
true.
Set to blank to have a range chosen with the default size.
Set to /netmask (e.g. ``/14``) to have a range chosen with a
specific netmask.
Set to a
`CIDR <http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing>`__
notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private
networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``,
``192.168.0.0/16``) to pick a specific range to use.
node_ipv4_cidr_block (str):
The IP address range of the instance IPs in this cluster.
This is applicable only if ``create_subnetwork`` is true.
Set to blank to have a range chosen with the default size.
Set to /netmask (e.g. ``/14``) to have a range chosen with a
specific netmask.
Set to a
`CIDR <http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing>`__
notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private
networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``,
``192.168.0.0/16``) to pick a specific range to use.
services_ipv4_cidr_block (str):
The IP address range of the services IPs in this cluster. If
blank, a range will be automatically chosen with the default
size.
This field is only applicable when ``use_ip_aliases`` is
true.
Set to blank to have a range chosen with the default size.
Set to /netmask (e.g. ``/14``) to have a range chosen with a
specific netmask.
Set to a
`CIDR <http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing>`__
notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private
networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``,
``192.168.0.0/16``) to pick a specific range to use.
tpu_ipv4_cidr_block (str):
The IP address range of the Cloud TPUs in this cluster. If
unspecified, a range will be automatically chosen with the
default size.
This field is only applicable when ``use_ip_aliases`` is
true.
If unspecified, the range will use the default size.
Set to /netmask (e.g. ``/14``) to have a range chosen with a
specific netmask.
Set to a
`CIDR <http://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing>`__
notation (e.g. ``10.96.0.0/14``) from the RFC-1918 private
networks (e.g. ``10.0.0.0/8``, ``172.16.0.0/12``,
``192.168.0.0/16``) to pick a specific range to use.
use_routes (bool):
Whether routes will be used for pod IPs in the cluster. This
is used in conjunction with use_ip_aliases. It cannot be
true if use_ip_aliases is true. If both use_ip_aliases and
use_routes are false, then the server picks the default IP
allocation mode
"""
use_ip_aliases = proto.Field(proto.BOOL, number=1,)
create_subnetwork = proto.Field(proto.BOOL, number=2,)
subnetwork_name = proto.Field(proto.STRING, number=3,)
cluster_ipv4_cidr = proto.Field(proto.STRING, number=4,)
node_ipv4_cidr = proto.Field(proto.STRING, number=5,)
services_ipv4_cidr = proto.Field(proto.STRING, number=6,)
cluster_secondary_range_name = proto.Field(proto.STRING, number=7,)
services_secondary_range_name = proto.Field(proto.STRING, number=8,)
cluster_ipv4_cidr_block = proto.Field(proto.STRING, number=9,)
node_ipv4_cidr_block = proto.Field(proto.STRING, number=10,)
services_ipv4_cidr_block = proto.Field(proto.STRING, number=11,)
tpu_ipv4_cidr_block = proto.Field(proto.STRING, number=13,)
use_routes = proto.Field(proto.BOOL, number=15,)
class Cluster(proto.Message):
r"""A Google Kubernetes Engine cluster.
Attributes:
name (str):
The name of this cluster. The name must be unique within
this project and location (e.g. zone or region), and can be
up to 40 characters with the following restrictions:
- Lowercase letters, numbers, and hyphens only.
- Must start with a letter.
- Must end with a number or a letter.
description (str):
An optional description of this cluster.
initial_node_count (int):
The number of nodes to create in this cluster. You must
ensure that your Compute Engine `resource
quota <https://cloud.google.com/compute/quotas>`__ is
sufficient for this number of instances. You must also have
available firewall and routes quota. For requests, this
field should only be used in lieu of a "node_pool" object,
since this configuration (along with the "node_config") will
be used to create a "NodePool" object with an auto-generated
name. Do not use this and a node_pool at the same time.
This field is deprecated, use node_pool.initial_node_count
instead.
node_config (google.cloud.container_v1.types.NodeConfig):
Parameters used in creating the cluster's nodes. For
requests, this field should only be used in lieu of a
"node_pool" object, since this configuration (along with the
"initial_node_count") will be used to create a "NodePool"
object with an auto-generated name. Do not use this and a
node_pool at the same time. For responses, this field will
be populated with the node configuration of the first node
pool. (For configuration of each node pool, see
``node_pool.config``)
If unspecified, the defaults are used. This field is
deprecated, use node_pool.config instead.
master_auth (google.cloud.container_v1.types.MasterAuth):
The authentication information for accessing the master
endpoint. If unspecified, the defaults are used: For
clusters before v1.12, if master_auth is unspecified,
``username`` will be set to "admin", a random password will
be generated, and a client certificate will be issued.
logging_service (str):
The logging service the cluster should use to write logs.
Currently available options:
- ``logging.googleapis.com/kubernetes`` - The Cloud Logging
service with a Kubernetes-native resource model
- ``logging.googleapis.com`` - The legacy Cloud Logging
service (no longer available as of GKE 1.15).