mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 05:01:46 +00:00
Merge pull request #25709 from asalkeld/null-deref
Automatic merge from submit-queue Check for an empty value in validateField ```release-note * Fix a panic when args was not supplied with any values. ``` reflect.TypeOf() can take a nil (it then returns a nil), but Kind() panics on a nil. Now the user gets the following output: ./kubectl.sh --server=http://localhost:8080 create -f ../../test-files/test-rc.yaml error validating "../../test-files/test-rc.yaml": error validating data: unexpected nil value for field spec.template.spec.containers[0].args[0]; if you choose to ignore these errors, turn validation off with --validate=false fixes #20627 and fixes #26927
This commit is contained in:
20
hack/testdata/invalid-rc-with-empty-args.yaml
vendored
Normal file
20
hack/testdata/invalid-rc-with-empty-args.yaml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
apiVersion: v1
|
||||
kind: ReplicationController
|
||||
metadata:
|
||||
name: kube-dns-v10
|
||||
namespace: kube-system
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
k8s-app: kube-dns
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
k8s-app: kube-dns
|
||||
spec:
|
||||
containers:
|
||||
- name: carbon-relay
|
||||
image: banno/carbon-relay
|
||||
args:
|
||||
-
|
||||
# above is the empty arg string.
|
Reference in New Issue
Block a user