-
Notifications
You must be signed in to change notification settings - Fork 40.3k
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
kubeadm: Replace the yaml in the log/comments with a generic term. #130345
base: master
Are you sure you want to change the base?
Conversation
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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-sigs/prow repository. |
8a02227
to
fb63528
Compare
/release-note-none |
LGTM label has been added. Git tree hash: 4de94b209ce33e899d62167ce8ea44456d8afa39
|
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.
thanks for the pr @HirazawaUi
}) | ||
docmap, err := kubeadmutil.SplitYAMLOrJSONDocuments(b) | ||
if err != nil { | ||
t.Fatalf("Unexpected error of SplitYAMLOrJSONDocuments: %v", err) |
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.
SplitConfigDocuments
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 is initconfiguration_test.go not calling docmap, err := kubeadmutil.SplitYAMLOrJSONDocuments(b)
as well?
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.
Because the BytesToInitConfiguration
function already includes SplitYAMLDocuments()
and documentMapToInitConfiguration()
.
ref:
kubernetes/cmd/kubeadm/app/util/config/initconfiguration.go
Lines 293 to 304 in 7bd0477
// BytesToInitConfiguration converts a byte slice to an internal, defaulted and validated InitConfiguration object. | |
// The map may contain many different YAML documents. These YAML documents are parsed one-by-one | |
// and well-known ComponentConfig GroupVersionKinds are stored inside of the internal InitConfiguration struct. | |
// The resulting InitConfiguration is then dynamically defaulted and validated prior to return. | |
func BytesToInitConfiguration(b []byte, skipCRIDetect bool) (*kubeadmapi.InitConfiguration, error) { | |
gvkmap, err := kubeadmutil.SplitYAMLDocuments(b) | |
if err != nil { | |
return nil, err | |
} | |
return documentMapToInitConfiguration(gvkmap, false, false, false, skipCRIDetect) | |
} |
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.
we should probably add BytesToXConfiguration for all kinds of config
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.
added.
for _, format := range formats { | ||
t.Run(fmt.Sprintf("%s_%s", tt.name, format.name), func(t *testing.T) { |
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.
since you are adding multi format testing for init and upgrade config, should you also add it to reset and join config?
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.
Added.
needs a simple release note explaining the user facing aspect of the change. |
fb63528
to
43ab8e3
Compare
New changes are detected. LGTM label has been removed. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: HirazawaUi The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
43ab8e3
to
bf89648
Compare
} | ||
|
||
if _, present := deprecatedAPIVersions[gvString]; present && !allowDeprecated { | ||
klog.Warningf("your configuration file uses a deprecated API spec: %q (kind: %q). Please use 'kubeadm config migrate --old-config old.yaml --new-config new.yaml', which will write the new, similar spec using a newer API version.", gvString, gvk.Kind) | ||
klog.Warningf("your configuration file uses a deprecated API spec: %q (kind: %q). Please use 'kubeadm config migrate ---old-config old-config-file --new-config new-config-file', which will write the new, similar spec using a newer API version.", gvString, gvk.Kind) |
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.
klog.Warningf("your configuration file uses a deprecated API spec: %q (kind: %q). Please use 'kubeadm config migrate ---old-config old-config-file --new-config new-config-file', which will write the new, similar spec using a newer API version.", gvString, gvk.Kind) | |
klog.Warningf("your configuration file uses a deprecated API spec: %q (kind: %q). Please use 'kubeadm config migrate --old-config old-config-file --new-config new-config-file', which will write the new, similar spec using a newer API version.", gvString, gvk.Kind) |
return BytesToJoinConfiguration(b, opts) | ||
} | ||
|
||
// BytesToJoinConfiguration converts a byte slice to an internal, defaulted and validated ResetConfiguration object. |
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.
JoinConfiguration
|
||
// BytesToJoinConfiguration converts a byte slice to an internal, defaulted and validated ResetConfiguration object. | ||
// The map may contain many different YAML/JSON documents. These documents are parsed one-by-one | ||
// and well-known ComponentConfig GroupVersionKinds are stored inside of the internal ResetConfiguration struct. |
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.
there are no component configs in reset config
} | ||
|
||
if obj == nil { | ||
t.Error("Unexpected nil return value") | ||
got, _ := LoadJoinConfigurationFromFile(tt.cfgPath, options) |
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 not use bytestojoinconfiguration instead of writing a file and reading it
we should make this consistent across xconfiguration_tests.go.
|
||
// BytesToResetConfiguration converts a byte slice to an internal, defaulted and validated ResetConfiguration object. | ||
// The map may contain many different YAML/JSON documents. These documents are parsed one-by-one | ||
// and well-known ComponentConfig GroupVersionKinds are stored inside of the internal ResetConfiguration struct. |
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.
there are no component configs in reset config
} | ||
|
||
if obj == nil { | ||
t.Error("Unexpected nil return value") | ||
got, _ := LoadResetConfigurationFromFile(tt.cfgPath, options) |
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.
again we should use bytestoresetconfiguration here instead of writing and loading
the load* functions can have another simple test, maybe
// BytesToUpgradeConfiguration converts a byte slice to an internal, defaulted and validated InitConfiguration object. | ||
// The map may contain many different YAML/JSON documents. These documents are parsed one-by-one | ||
// and well-known ComponentConfig GroupVersionKinds are stored inside of the internal UpgradeConfiguration struct. | ||
// The resulting UpgradeConfiguration is then dynamically defaulted and validated prior to return. |
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.
similar copy paste errors
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes kubernetes/kubeadm#3163 kubernetes/kubeadm#3162
Special notes for your reviewer:
To make the functions appear more consistent, I also renamed the SplitYAMLDocuments function to SplitYAMLOrJSONDocuments. If this is an unnecessary change, I can roll it back.
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: