Skip to content

Commit

Permalink
✨ Add GCP GKE cluster node pool management (#967)
Browse files Browse the repository at this point in the history
Add an extra property for the GCP GKE cluster node pool management:
```typescript
cnquery> gcp.project.gke.clusters{nodePools{ management }}
gcp.project.gke.clusters: [
  0: {
    nodePools: [
      0: {
        management: {
          autoRepair: true
          autoUpgrade: true
          upgradeOptions: {}
        }
      }
      1: {
        management: {
          autoRepair: true
          autoUpgrade: true
          upgradeOptions: {}
        }
      }
    ]
  }
]
```

Signed-off-by: Ivan Milchev <ivan@mondoo.com>
  • Loading branch information
imilchev authored Feb 27, 2023
1 parent 0d703ab commit b5b7b29
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
2 changes: 2 additions & 0 deletions resources/packs/gcp/gcp.lr
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,8 @@ private gcp.project.gkeService.cluster.nodepool @defaults("name") {
instanceGroupUrls []string
// The current status of this node pool
status string
// Node management configuration
management dict
}

// GCP GKE node pool-level network configuration
Expand Down
30 changes: 30 additions & 0 deletions resources/packs/gcp/gcp.lr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions resources/packs/gcp/gke.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,22 @@ func createMqlNodePool(runtime *resources.Runtime, np *containerpb.NodePool, clu
return nil, err
}

var management map[string]interface{}
if np.Management != nil {
var upgradeOpts map[string]interface{}
if np.Management.UpgradeOptions != nil {
upgradeOpts = map[string]interface{}{
"autoUpgradeStartTime": np.Management.UpgradeOptions.AutoUpgradeStartTime,
"description": np.Management.UpgradeOptions.Description,
}
}
management = map[string]interface{}{
"autoRepair": np.Management.AutoRepair,
"autoUpgrade": np.Management.AutoUpgrade,
"upgradeOptions": upgradeOpts,
}
}

return runtime.CreateResource("gcp.project.gkeService.cluster.nodepool",
"id", nodePoolId,
"name", np.Name,
Expand All @@ -378,6 +394,7 @@ func createMqlNodePool(runtime *resources.Runtime, np *containerpb.NodePool, clu
"version", np.Version,
"instanceGroupUrls", core.StrSliceToInterface(np.InstanceGroupUrls),
"status", np.Status.String(),
"management", management,
)
}

Expand Down
2 changes: 1 addition & 1 deletion resources/packs/gcp/info/gcp.lr.json

Large diffs are not rendered by default.

0 comments on commit b5b7b29

Please sign in to comment.