Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Error in gcp_kubernetes_node_pool table if gke autopilot is used Closes #585 #591

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions gcp/table_gcp_kubernetes_node_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ func listKubernetesNodePools(ctx context.Context, d *plugin.QueryData, h *plugin
// Get the details of Cluster
cluster := h.Item.(*container.Cluster)

// This operation is not allowed if the cluster has Autopilot Enabled.
// We are getting the error Error: gcp: googleapi: Error 400: Autopilot node pools cannot be accessed or modified.

if cluster.Autopilot.Enabled {
return nil, nil
}

// Create Service Connection
service, err := ContainerService(ctx, d)
if err != nil {
Expand Down Expand Up @@ -205,6 +212,11 @@ func getKubernetesNodePool(ctx context.Context, d *plugin.QueryData, h *plugin.H

resp, err := service.Projects.Locations.Clusters.NodePools.Get(parent).Do()
if err != nil {
// This operation is not allowed if the cluster has Autopilot Enabled.
// We are getting the error Error: gcp: googleapi: Error 400: Autopilot node pools cannot be accessed or modified.
if strings.Contains(err.Error(), "Autopilot node pools cannot be accessed or modified") {
return nil, nil
}
return nil, err
}

Expand Down
Loading