Fixing schema definitions bugs#202
Merged
Merged
Conversation
61744be to
2c2f18c
Compare
tomleb
reviewed
May 13, 2024
Contributor
tomleb
left a comment
There was a problem hiding this comment.
Overall looks good to me, 1 question and 1 suggestion
tomleb
approved these changes
May 13, 2024
Fixes two bugs with the schema definitions: - Adds resources that are a part of the baseSchema (but aren't k8s resources). - Adds logic to handle resources which aren't in a prefered version, but are still in some version.
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.
Overview
This is related to rancher/rancher#45158, and resolves two of the issues identified in the issue summary. Specifically:
generateKubeconfigOutput) which are added as custom schemas - these don't represent real k8s resources. However, since they are still top-level schemas, they need definitions.monitoring.coreos.com.alertmanagerconfigfrom the rancher-monitoring chart) are not in the preferred version of the group, but are in some version of the group.monitoring.coreos.com.alertmanagerconfig, for example, appears in thev1alpha1version, but not in thev1version which is the preferred version of the group.This does not address the third issue - this should be addressed by the work on rancher/rancher#45157, since these resources represent CRDs that have no typing information in kubernetes.
Solution Detail
baseSchemaconfigured for the server to the SchemaDefinitionHandler. This contains the configured, built-in schemas (such as generateKubeconfigOutput).baseSchema(which is just used to determine if this resource is a base schema). This is done in case the schema has been transformed for this user - baseSchemas are setup-wide, where the schemas on the request are specific to the user.resourceFiledsin/v1/schemas. Since the impact of this is relatively low, this wasn't resolved in this PR.typefield on the resource fields for cases of complex types likemap[string]. This is done using an import from wrangler, which is used for similar purposes in ranchermasterstate, resources are only added when they are in the preferred version for a group.Notes
Tests were added for the above cases to maintain coverage.