Skip to content

Improve logging warning when enountering profile field of unhandled type#2691

Merged
tejal29 merged 4 commits intoGoogleContainerTools:masterfrom
briandealwis:profilelog
Aug 21, 2019
Merged

Improve logging warning when enountering profile field of unhandled type#2691
tejal29 merged 4 commits intoGoogleContainerTools:masterfrom
briandealwis:profilelog

Conversation

@briandealwis
Copy link
Copy Markdown
Member

The logging for the error fixed in #2662 is a bit puzzling:

WARN[0000] unknown field type in profile overlay: int. falling back to original config values

It seems that the name for primitive fields is just the type. This PR changes the callers of overlayProfileField() to pass in the YAML field name, and adds a new function in the yamltags package to extract the yaml tag name from a StructField.

You can see it in action by adding a new field of an unsupported basic type, like float32:

WARN[0000] Type mismatch in profile overlay for field 'minging' with type float32; falling back to original config values 
--- a/pkg/skaffold/schema/latest/config.go
+++ b/pkg/skaffold/schema/latest/config.go
@@ -336,6 +336,7 @@ type TestCase struct {
 
 // DeployConfig contains all the configuration needed by the deploy steps.
 type DeployConfig struct {
+       Minging float32 `yaml:"minging,omitempty"`
        // StatusCheckDeadlineSeconds *beta* is the deadline for deployments to stabilize in seconds.
        StatusCheckDeadlineSeconds int `yaml:"statusCheckDeadlineSeconds,omitempty"`
        DeployType                 `yaml:",inline"`

@tejal29 tejal29 merged commit 91e18f6 into GoogleContainerTools:master Aug 21, 2019
@briandealwis briandealwis deleted the profilelog branch August 21, 2019 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants