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

kubernetes_node_pool: fix fetching node-pool when AutoPilot is not available #668

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

multani
Copy link

@multani multani commented Oct 17, 2024

When AutoPilot is not available (not disabled), cluster.Autopilot is nil and cluster.Autopilot.Enabled crashes the plugin with a invalid memory address or nil pointer dereference error.

Integration test logs

Logs

Example query results

Results

Before the fix:

> select name, autopilot_enabled from gcp_kubernetes_cluster;
+-----------+-------------------+
| name      | autopilot_enabled |
+-----------+-------------------+
| cluster-3 | false             |
| cluster-4 | false             |
| cluster-1 | <null>            |
| cluster-2 | false             |
+-----------+-------------------+
>
> select cluster_name, name from gcp_kubernetes_node_pool where cluster_name = 'cluster-4' order by name limit 1;

Error: test_gcp: runtime error: invalid memory address or nil pointer dereference (SQLSTATE HV000)

+--------------+------+
| cluster_name | name |
+--------------+------+
+--------------+------+
>
> select cluster_name, name from gcp_kubernetes_node_pool where cluster_name = 'cluster-3' order by name limit 1;

Error: test_gcp: runtime error: invalid memory address or nil pointer dereference (SQLSTATE HV000)

+--------------+------+
| cluster_name | name |
+--------------+------+
+--------------+------+
>

After the fix:

> select name, autopilot_enabled from gcp_kubernetes_cluster;
+-----------+-------------------+
| name      | autopilot_enabled |
+-----------+-------------------+
| cluster-3 | false             |
| cluster-4 | false             |
| cluster-1 | <null>            |
| cluster-2 | false             |
+-----------+-------------------+
>
> select cluster_name, name from gcp_kubernetes_node_pool where cluster_name = 'cluster-4' order by name limit 1;
+---------------+-------------+
| cluster_name  | name        |
+---------------+-------------+
| cluster-4     | node-pool-1 |
+---------------+-------------+
>
> select cluster_name, name from gcp_kubernetes_node_pool where cluster_name = 'cluster-3' order by name limit 1;
+---------------+-------------+
| cluster_name  | name        |
+---------------+-------------+
| cluster-3     | node-pool-1 |
+---------------+-------------+
>

…ailable

When AutoPilot is not available (not *disabled*),
`cluster.Autopilot` is `nil` and `cluster.Autopilot.Enabled` crashes the
plugin with a `invalid memory address or nil pointer dereference` error.
@misraved misraved self-requested a review October 17, 2024 12:53
@misraved misraved added the hacktoberfest-accepted This pull request has been accepted for Hacktoberfest label Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted This pull request has been accepted for Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants