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

fix inconsistent columns #229

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

dongho-jung
Copy link
Contributor

fix #227 [Inconsistent DDL (Column order changes, and some columns are intermittently missing)]

To facilitate comparison, I inserted the following code in here temporarily.

		if strings.Contains(crd.Spec.Names.Singular, "nodeclass") {
			a := tableKubernetesCustomResource(ctx)
			columnNames := []string{}
			for _, column := range a.Columns {
				columnNames = append(columnNames, column.Name)
			}
			sort.Strings(columnNames)
			plugin.Logger(ctx).Warn("tableKubernetesCustomResource", columnNames)
		}

And the following is a comparison of the logs before and after applying the PR.

[as-is]

❯ tail -f ~/.steampipe/logs/plugin-2024-05-31.log                                                                                    14:13:39
2024-05-31 05:13:49.861 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "tags", "uid", "user_data"]
2024-05-31 05:13:51.633 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "tags", "uid", "user_data"]
2024-05-31 05:13:53.146 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "security_groups", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]
2024-05-31 05:14:15.870 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]
2024-05-31 05:14:18.176 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "tags", "uid", "user_data"]
2024-05-31 05:14:19.661 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "security_groups", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]
2024-05-31 05:14:38.304 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]
2024-05-31 05:14:39.948 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "tags", "uid", "user_data"]
2024-05-31 05:14:41.907 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "tags", "uid", "user_data"]

[to-be]

❯ tail -f ~/.steampipe/logs/plugin-2024-05-31.log                                                                                    14:16:15
2024-05-31 05:16:18.823 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "security_groups", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]
2024-05-31 05:16:21.244 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "security_groups", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]
2024-05-31 05:16:22.985 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "security_groups", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]
2024-05-31 05:16:34.780 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "security_groups", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]
2024-05-31 05:16:36.720 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "security_groups", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]
2024-05-31 05:16:39.425 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "security_groups", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]
2024-05-31 05:16:49.373 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "security_groups", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]
2024-05-31 05:16:51.133 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "security_groups", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]
2024-05-31 05:16:52.750 UTC [WARN]  steampipe-plugin-kubernetes.plugin: [WARN]  tableKubernetesCustomResource: EXTRA_VALUE_AT_END=["ami_family", "ami_selector_terms", "amis", "annotations", "api_version", "block_device_mappings", "context", "context_name", "creation_timestamp", "detailed_monitoring", "end_line", "instance_profile", "instance_store_policy", "kind", "labels", "metadata_options", "name", "namespace", "path", "role", "security_group_selector_terms", "security_groups", "source_type", "start_line", "status_instance_profile", "subnet_selector_terms", "subnets", "tags", "uid", "user_data"]

I also confirmed consistent results in both Steampipe and DataGrip after testing eight times on three clusters.

I couldn't run the tests because I didn't know how to do them. If you have any instructions, please let me know!

@dongho-jung
Copy link
Contributor Author

I couldn't perform a regression test, so I'm not sure if there might be any unintended side effects...

@misraved misraved merged commit 494d1ff into turbot:main Jun 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent DDL (Column order changes, and some columns are intermittently missing)
3 participants