Fix SSA managed-fields type converter for scanner group#61
Open
ArnobKumarSaha wants to merge 2 commits into
Open
Fix SSA managed-fields type converter for scanner group#61ArnobKumarSaha wants to merge 2 commits into
ArnobKumarSaha wants to merge 2 commits into
Conversation
The OpenAPI v2 `ignore` list, which excludes the scanner group prefix (/apis/scanner.appscode.com/v1alpha1), was reused for OpenAPIV3Config. Since server-side apply builds its managed-fields type converter from the v3 config (getOpenAPIModels -> getResourceNamesForGroup skips any resource under an IgnorePrefixes entry), every scanner resource was dropped from the converter, causing "no corresponding type for scanner.appscode.com/v1alpha1" on every write and leaving managedFields unpopulated. Give the v3 config its own IgnorePrefixes of just /swaggerapi so the scanner resources reach the converter. The v2 published-spec behavior is unchanged. Signed-off-by: Arnob kumar saha <arnob@appscode.com>
`type Time metav1.Time` strips metav1.Time's OpenAPISchema* methods, so openapi-gen emitted an object schema (a map with a "Time" property) while Time marshals as a scalar RFC3339 string. The SSA managed-fields type converter then rejected every ImageScanReport with "expected map, got <timestamp>" on .status.report.metadata.imageConfig.created and history[]. Re-add OpenAPISchemaType/OpenAPISchemaFormat mirroring metav1.Time so the generated schema is a scalar date-time string, and regenerate. Signed-off-by: Arnob kumar saha <arnob@appscode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Every write to a
scanner.appscode.com/v1alpha1object logs:and
metadata.managedFieldsis never populated.Root cause
start.gobuilt oneignorelist for the OpenAPI v2 config — which excludes the scanner group prefix/apis/scanner.appscode.com/v1alpha1— and then reused it forOpenAPIV3Config.Server-side apply (GA) builds its managed-fields type converter from the v3 config:
GenericAPIServer.getOpenAPIModels→getResourceNamesForGroupskips any resource whose path is under anIgnorePrefixesentry. Sinceapi.SchemeGroupVersion.String()isscanner.appscode.com/v1alpha1, that prefix matches every scanner resource, so all of them are dropped from the converter's GVK→schema map →no corresponding typeon every write.Fix
Give the v3 config its own
IgnorePrefixes = []string{"/swaggerapi"}instead of reusing the v2ignorelist. The scanner resources now reach the converter; the v2 published-spec behavior is unchanged.Verification
go build ./...green. On a cluster running this build, anUpdate/Applypopulatesmetadata.managedFieldsand the[SHOULD NOT HAPPEN]line is gone.