New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validation: Enforce strict unmarshalling of config #5307
validation: Enforce strict unmarshalling of config #5307
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Can you add a unit test case covering an unknown field?
- Can you show me the full error message from the installer when an unknown field is used?
Fixed the ordering and this is the output
I am facing some problems with handling deprecated install configs. There is a unit test failing that has an old valid install config and not sure how to handle deprecated fields that are not in the schema. |
What is the deprecated field? There should not be any fields that are valid and not in the |
It's a test here. The field "network" is causing problems. It's changed to "networking" in the new schema.
|
Ha! That is actually a bad test case. The |
See here where the field name in v1beta3 was |
Nice! I'll fix it then. |
837686c
to
b2b76b8
Compare
@@ -189,7 +189,21 @@ platform: | |||
region: us-east-1 | |||
pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"authorization value\"}}}" | |||
network: | |||
type: OpenShiftSDN | |||
type: OpenshiftSDN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change this to an invalid network type?
@@ -189,7 +189,21 @@ platform: | |||
region: us-east-1 | |||
pullSecret: "{\"auths\":{\"example.com\":{\"auth\":\"authorization value\"}}}" | |||
network: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a field name that is clearly unknown rather than a field name that is similar to a known field. It is hard reading the test case input to spot immediately which field is wrong.
b2b76b8
to
1a2f368
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just one minor nit.
{ | ||
name: "unknown field", | ||
data: ` | ||
apiVersion: v1beta3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
apiVersion: v1beta3 | |
apiVersion: v1 |
In order to stop the user from adding unrecognized properties in the install config, a validation check is added to force the user to remove them. This is done by enforcing a strict unmarshalling of the install config yaml file that will raise an error when an unknown property is added. This will force the installer to return an error for the first occurence of an unknown property since the current library returns only the first unknown field.
1a2f368
to
785921b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: staebler The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
4 similar comments
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
7 similar comments
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
@rna-afk: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
8 similar comments
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
/retest-required Please review the full test history for this PR and help us cut down flakes. |
The openstack manifests tests use an install config with the clusterID field that is no longer supported by the installer. Changes to the installer to enforce strict unmarshalling of the install config is in place but is being hindered by the openstack manifests tests in this PR. openshift#5307
The validation for the install config was tightened in this PR openshift/installer#5307 and it's causing the e2e-azurestack tests to fail so fixing the install config to conform to the validation.
The openstack manifests tests use an install config with the clusterID field that is no longer supported by the installer. Changes to the installer to enforce strict unmarshalling of the install config is in place but is being hindered by the openstack manifests tests in this PR. openshift#5307
In order to stop the user from adding unrecognized properties
in the install config, a validation check is added to force the
user to remove them. This is done by enforcing a strict
unmarshalling of the install config yaml file that will raise an
error when an unknown property is added.
This will force the installer to return an error for the first
occurence of an unknown property since the current library
returns only the first unknown field.