Unverified Commit 501e3f7e authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #67707 from apelisse/fix-diff-404

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. diff: Fix crash when remote object doesn't exist Since we're saving nil in an interface rather than the implementation, we can't compare to nil to check if the remote object exists or not. Change the struct to save in the implementation. **What this PR does / why we need it**: **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents 83030032 a3417fe6
...@@ -265,7 +265,7 @@ type Object interface { ...@@ -265,7 +265,7 @@ type Object interface {
// InfoObject is an implementation of the Object interface. It gets all // InfoObject is an implementation of the Object interface. It gets all
// the information from the Info object. // the information from the Info object.
type InfoObject struct { type InfoObject struct {
Remote runtime.Unstructured Remote *unstructured.Unstructured
Info *resource.Info Info *resource.Info
Encoder runtime.Encoder Encoder runtime.Encoder
Parser *parse.Factory Parser *parse.Factory
......
...@@ -26,6 +26,10 @@ run_kubectl_diff_tests() { ...@@ -26,6 +26,10 @@ run_kubectl_diff_tests() {
create_and_use_new_namespace create_and_use_new_namespace
kube::log::status "Testing kubectl alpha diff" kube::log::status "Testing kubectl alpha diff"
# Test that it works when the live object doesn't exist
output_message=$(kubectl alpha diff LOCAL LIVE -f hack/testdata/pod.yaml)
kube::test::if_has_string "${output_message}" 'test-pod'
kubectl apply -f hack/testdata/pod.yaml kubectl apply -f hack/testdata/pod.yaml
# Ensure that selfLink has been added, and shown in the diff # Ensure that selfLink has been added, and shown in the diff
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment