Skip to content

Conversation

@misraved
Copy link
Contributor

@misraved misraved commented Dec 2, 2025

Example query results

Results
Add example SQL query results here (please include the input queries as well)

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the .report root field in custom resource definitions (CRDs), following the same pattern as the existing .spec and .status fields. This enables Kubernetes CRD plugins to extract and expose report-level properties as columns in Steampipe tables.

Key Changes:

  • Added support for extracting and displaying report fields from custom resources
  • Implemented column generation logic for report properties with prefix handling
  • Added new extractReportProperty function to retrieve report field values

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

func getCustomResourcesDynamicColumns(ctx context.Context, versionSchemaSpec interface{}, versionSchemaStatus interface{}) []*plugin.Column {
func getCustomResourcesDynamicColumns(ctx context.Context, versionSchemaSpec interface{}, versionSchemaStatus interface{},versionSchemaReport interface{}) []*plugin.Column {
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after comma in function parameter list. Should be versionSchemaStatus interface{}, versionSchemaReport interface{} instead of versionSchemaStatus interface{},versionSchemaReport interface{}.

Suggested change
func getCustomResourcesDynamicColumns(ctx context.Context, versionSchemaSpec interface{}, versionSchemaStatus interface{},versionSchemaReport interface{}) []*plugin.Column {
func getCustomResourcesDynamicColumns(ctx context.Context, versionSchemaSpec interface{}, versionSchemaStatus interface{}, versionSchemaReport interface{}) []*plugin.Column {

Copilot uses AI. Check for mistakes.
}

// add the report columns
schemaReport := versionSchemaReport.(v1.JSONSchemaProps)
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential panic due to type assertion without nil check. If versionSchemaReport is nil, this type assertion will panic. Consider adding a nil check similar to the existing pattern or handling the case where report schema might not be present in the CRD:

if versionSchemaReport != nil {
    schemaReport := versionSchemaReport.(v1.JSONSchemaProps)
    // ... rest of the report columns logic
}

Copilot uses AI. Check for mistakes.
Name: strcase.ToSnake(k),
Description: v.Description,
Transform: transform.FromP(extractReportProperty, k),
}
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The report columns logic does not update the allColumns slice when a new column is added (flag == 0), unlike the spec columns logic at line 75. This could lead to duplicate column names if subsequent sections (like report) have properties that overlap with earlier sections. Consider adding:

if flag == 0 {
    column := &plugin.Column{
        Name:        strcase.ToSnake(k),
        Description: v.Description,
        Transform:   transform.FromP(extractReportProperty, k),
    }
    allColumns = append(allColumns, strcase.ToSnake(k))  // Add this line
    setDynamicColumns(v, column)
    columns = append(columns, column)
}
Suggested change
}
}
allColumns = append(allColumns, strcase.ToSnake(k))

Copilot uses AI. Check for mistakes.
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.

3 participants