k8snetworkplumbingwg / net-attach-def-admission-controller

An admission controller to check resources as defined by the NPWG spec
Apache License 2.0
4 stars 15 forks source link

[validation] Allows empty spec.config #24

Closed dougbtv closed 5 years ago

dougbtv commented 5 years ago

According to the spec section 3.4.1 we can allow an empty spec.config field in order to pick up on-disk configurations with the specified name.

This change removes the gate on netAttachDef.Spec.Config == "" and instead allows it, outputting an informational log message stating that it passed an empty config through.

I proved out the changes using these two specs:

cat <<EOF | kubectl create -f -
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: empty-conf
spec:
  config: ''
EOF

cat <<EOF | kubectl create -f -
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: empty2-conf
EOF
s1061123 commented 5 years ago

Looks good to me, thanks!