Syntax
A google_container_clusters
is used to test a Google Cluster resource
Beta Resource
This resource has beta fields available. To retrieve these fields, include beta: true
in the constructor for the resource
Examples
describe google_container_clusters(project: 'chef-gcp-inspec', location: 'europe-west2-a') do
its('cluster_names') { should include 'gcp-inspec-kube-cluster' }
end
Test that there are no more than a specified number of clusters available for the project in a particular zone
describe google_container_clusters(project: 'chef-inspec-gcp', location: 'europe-west2-a') do
its('count') { should be <= 5}
end
Test that an expected cluster is available for the project
describe google_container_clusters(project: 'chef-inspec-gcp', location: 'europe-west2-a') do
its('cluster_names') { should include "my-cluster" }
end
Test whether any clusters are in status “STOPPING”
describe google_container_clusters(project: 'chef-inspec-gcp', location: 'europe-west2-a') do
its('cluster_statuses') { should_not include "STOPPING" }
end
Test that a subset of all clusters matching “kube*” are “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
Properties
Properties that can be accessed from the google_container_clusters
resource:
See googlecontainercluster.md for more detailed information
* cluster_names
: an array of google_container_cluster
name
* descriptions
: an array of google_container_cluster
description
* initial_node_counts
: an array of google_container_cluster
initialnodecount
* node_configs
: an array of google_container_cluster
nodeconfig
* `masterauths: an array of
googlecontainerclustermaster_auth
*
loggingservices: an array of
googlecontainercluster` loggingservice
* monitoring_services
: an array of google_container_cluster
monitoringservice
* `clusternetworks: an array of
googlecontainerclusternetwork
*
privateclusterconfigs: an array of
googlecontainerclusterprivate_cluster_config
*
clusteripv4cidrs: an array of
googlecontainerclustercluster_ipv4_cidr
*
enabletpus: an array of
googlecontainercluster` enabletpu
* tpu_ipv4_cidr_blocks
: an array of google_container_cluster
tpuipv4cidrblock
* `addonsconfigs: an array of
googlecontainerclusteraddons_config
*
subnetworks: an array of
googlecontainerclustersubnetwork
*
locations: an array of
googlecontainerclusterlocations
*
resourcelabels: an array of
googlecontainercluster` resourcelabels
* label_fingerprints
: an array of google_container_cluster
labelfingerprint
* `legacyabacs: an array of
googlecontainerclusterlegacy_abac
*
networkpolicies: an array of
googlecontainercluster` networkpolicy
* default_max_pods_constraints
: an array of google_container_cluster
defaultmaxpodsconstraint
* `ipallocationpolicies: an array of
googlecontainercluster` ipallocationpolicy
* endpoints
: an array of `googlecontainerclusterendpoint
*
initialclusterversions: an array of
googlecontainercluster` initialclusterversion
* `currentmasterversions: an array of
googlecontainercluster` currentmasterversion
* `currentnodeversions: an array of
googlecontainercluster` currentnodeversion
* `createtimes: an array of
googlecontainerclustercreate_time
*
clusterstatuses: an array of
googlecontainerclusterstatus
*
statusmessages: an array of
googlecontainerclusterstatus_message
*
nodeipv4cidrsizes: an array of
googlecontainercluster` nodeipv4cidrsize
* services_ipv4_cidrs
: an array of google_container_cluster
servicesipv4cidr
* current_node_counts
: an array of google_container_cluster
currentnodecount
* expire_times
: an array of google_container_cluster
expiretime
* conditions
: an array of `googlecontainerclusterconditions
*
masterauthorizednetworksconfigs: an array of
googlecontainerclustermaster_authorized_networks_config
*
nodepools: an array of
googlecontainercluster` nodepools
* pod_security_policy_configs
: (Beta only) an array of google_container_cluster
podsecuritypolicyconfig
* `binaryauthorizations: an array of
googlecontainerclusterbinary_authorization
*
locations: an array of
googlecontainercluster` location
Filter Criteria
This resource supports all of the above properties as filter criteria, which can be used
with where
as a block or a method.
GCP Permissions
Ensure the Kubernetes Engine API is enabled for the current project.