Closed varunthakur2480 closed 3 weeks ago
Hi @varunthakur2480
The Nodepool resource appears to be functioning correctly. The issue you’re encountering is likely due to the absence of configurations. You can use the following approach to handle this:
node_pool = google_container_node_pool(project: gcp_project_id, location: gcp_kube_cluster_zone, cluster_name: gcp_kube_cluster_name, nodepool_name: regional_node_pool['name'])
taints = node_pool.config.taints
taints&.each do |taint|
describe taint do
its('key') { should eq 'cloud.google.com/gke-spot' }
its('value') { should eq 'true' }
its('effect') { should eq 'NO_SCHEDULE' }
end
end
response -
I am trying to add some checks on my GKE nodepool resources and using the documentation to get the following its('config.taints.key') {should eq "cloud.google.com/gke-spot"} its('config.taints.value') {should be true} its('config.taints.effect') {should eq "NO_SCHEDULE"}
But it fails with following error undefined method
[2024-06-28 13:18:41] × NodePool abc-20240628065114347700000001 config.taints.effect
[2024-06-28 13:18:41] undefined method ::GoogleInSpec::Container::Property::NodePoolConfig:0x0000000008dc1ee8>
key' for #<Array:0x0000000008dc1e70> [2024-06-28 13:18:41] × NodePool abc-20240628065114347700000001 config.taints.value [2024-06-28 13:18:41] undefined method
value' for #effect' for #<Array:0x0000000008dc1e70> [2024-06-28 13:18:41] × NodePool abc-20240628065114347700000001 config.spot [2024-06-28 13:18:41] undefined method
spot' for #<#I am using inspec-gcp-1.11.101.tar.gz binary
Possible Solution