Ресурс google_container_clusters
Синтаксис
Для проверки ресурса кластера Google используется google_container_clusters.
Ресурс Beta
В этом ресурсе доступны поля beta. Для получения этих полей включите beta: true в конструктор ресурса.
Примеры
describe google_container_clusters(project: 'chef-gcp-inspec', location: 'europe-west2-a') do
its('cluster_names') { should include 'gcp-inspec-kube-cluster' }
end
Проверка, что для проекта в конкретной зоне доступно не более заданного количества кластеров
describe google_container_clusters(project: 'chef-inspec-gcp', location: 'europe-west2-a') do
its('count') { should be <= 5}
end
Проверка, что ожидаемый кластер доступен для проекта
describe google_container_clusters(project: 'chef-inspec-gcp', location: 'europe-west2-a') do
its('cluster_names') { should include "my-cluster" }
end
Проверка, есть ли кластеры в статусе «STOPPING»
describe google_container_clusters(project: 'chef-inspec-gcp', location: 'europe-west2-a') do
its('cluster_statuses') { should_not include "STOPPING" }
end
Проверка, что подмножество всех кластеров, соответствующих «kube*», находятся в состоянии «RUNNING»
google_container_clusters(project: gcp_project_id).where(cluster_name: /^kube/).cluster_names.each do |cluster_name|
describe google_container_cluster(project: 'chef-inspec-gcp', location: 'europe-west2-a', name: cluster_name) do
it { should exist }
its('status') { should eq 'RUNNING' }
end
end
Свойства
Свойства, к которым можно получить доступ из ресурса google_container_clusters:
Для получения дополнительной информации см. ресурс google_container_cluster.
cluster_names- массив
google_container_clusterимён descriptions- массив
google_container_clusterописаний initial_node_counts- массив
google_container_clusterinitial_node_count node_configs- массив
google_container_clusternode_config master_auths- массив
google_container_clustermaster_auth logging_services- массив
google_container_clusterlogging_service monitoring_services- массив
google_container_clustermonitoring_service cluster_networks- массив
google_container_clusternetwork private_cluster_configs- массив
google_container_clusterprivate_cluster_config cluster_ipv4_cidrs- массив
google_container_clustercluster_ipv4_cidr enable_tpus- массив
google_container_clusterenable_tpu tpu_ipv4_cidr_blocks- массив
google_container_clustertpu_ipv4_cidr_block addons_configs- массив
google_container_clusteraddons_config subnetworks- массив
google_container_clustersubnetwork locations- массив
google_container_clusterlocations resource_labels- массив
google_container_clusterresource_labels label_fingerprints- массив
google_container_clusterlabel_fingerprint legacy_abacs- массив
google_container_clusterlegacy_abac network_policies- массив
google_container_clusternetwork_policy default_max_pods_constraints- массив
google_container_clusterdefault_max_pods_constraint ip_allocation_policies- массив
google_container_clusterip_allocation_policy endpoints- массив
google_container_clusterendpoint initial_cluster_versions- массив
google_container_clusterinitial_cluster_version current_master_versions- массив
google_container_clustercurrent_master_version current_node_versions- массив
google_container_clustercurrent_node_version create_times- массив
google_container_clustercreate_time cluster_statuses- массив
google_container_clusterstatus status_messages- массив
google_container_clusterstatus_message node_ipv4_cidr_sizes- массив
google_container_clusternode_ipv4_cidr_size services_ipv4_cidrs- массив
google_container_clusterservices_ipv4_cidr current_node_counts- массив
google_container_clustercurrent_node_count expire_times- массив
google_container_clusterexpire_time conditions- массив
google_container_clusterconditions master_authorized_networks_configs- массив
google_container_clustermaster_authorized_networks_config node_pools- массив
google_container_clusternode_pools pod_security_policy_configs- (Только beta) массив
google_container_clusterpod_security_policy_config binary_authorizations- массив
google_container_clusterbinary_authorization locations- массив
google_container_clusterlocation
Критерии фильтрации
Этот ресурс поддерживает все вышеперечисленные свойства в качестве критериев фильтрации, которые могут быть использованы с where как блоком, так и методом.
Разрешения GCP
Убедитесь, что для текущего проекта включен API Kubernetes Engine по адресу Kubernetes Engine API.
© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/inspec/resources/google_container_clusters/