mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Merge pull request #62060 from WanLinghao/namespace_miss_fix
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>. fix namespace miss bug **What this PR does / why we need it**: This patch fixes the namespace miss problems. I am not sure if this is the correct way it should be fixed. Just offer a solution. **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 #62059 **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
commit
03eb9f687f
@ -4486,6 +4486,20 @@ run_kubectl_all_namespace_tests() {
|
|||||||
# Command
|
# Command
|
||||||
kubectl get pods --all-namespaces --namespace=default
|
kubectl get pods --all-namespaces --namespace=default
|
||||||
|
|
||||||
|
### Check --all-namespaces option shows namespaces
|
||||||
|
# Create objects in multiple namespaces
|
||||||
|
kubectl create "${kube_flags[@]}" namespace all-ns-test-1
|
||||||
|
kubectl create "${kube_flags[@]}" serviceaccount test -n all-ns-test-1
|
||||||
|
kubectl create "${kube_flags[@]}" namespace all-ns-test-2
|
||||||
|
kubectl create "${kube_flags[@]}" serviceaccount test -n all-ns-test-2
|
||||||
|
# Ensure listing across namespaces displays the namespace
|
||||||
|
output_message=$(kubectl get serviceaccounts --all-namespaces "${kube_flags[@]}")
|
||||||
|
kube::test::if_has_string "${output_message}" "all-ns-test-1"
|
||||||
|
kube::test::if_has_string "${output_message}" "all-ns-test-2"
|
||||||
|
# Clean up
|
||||||
|
kubectl delete "${kube_flags[@]}" namespace all-ns-test-1
|
||||||
|
kubectl delete "${kube_flags[@]}" namespace all-ns-test-2
|
||||||
|
|
||||||
### Clean up
|
### Clean up
|
||||||
# Pre-condition: valid-pod exists
|
# Pre-condition: valid-pod exists
|
||||||
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'valid-pod:'
|
kube::test::get_object_assert pods "{{range.items}}{{$id_field}}:{{end}}" 'valid-pod:'
|
||||||
|
@ -614,6 +614,22 @@ func (o *GetOptions) decodeIntoTable(encoder runtime.Encoder, obj runtime.Object
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for i := range table.Rows {
|
||||||
|
row := &table.Rows[i]
|
||||||
|
if row.Object.Raw == nil || row.Object.Object != nil {
|
||||||
|
//if row already has Object.Object
|
||||||
|
//we don't change it
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
converted, err := runtime.Decode(unstructured.UnstructuredJSONScheme, row.Object.Raw)
|
||||||
|
if err != nil {
|
||||||
|
//if error happens, we just continue
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
row.Object.Object = converted
|
||||||
|
}
|
||||||
|
|
||||||
return table, nil
|
return table, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user