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.alertmanagerconfig
from 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 thev1alpha1
version, but not in thev1
version 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
baseSchema
configured 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.resourceFileds
in/v1/schemas
. Since the impact of this is relatively low, this wasn't resolved in this PR.type
field 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 ranchermaster
state, 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.