kubeval
kubeval copied to clipboard
Validation passes on service with no name
version:
kubeval --version
Version: 0.14.0
Commit: eae975a0031c57f01976474f428861f50cfc551e
Date: 2019-09-01T10:07:27Z
definition:
cat def.yaml
---
apiVersion: v1
kind: Service
metadata:
name:
labels:
app: my-service
spec:
type: ClusterIP
ports:
- port: 4665
targetPort: 4665
protocol: TCP
name: http
selector:
app: my-service
test:
kubeval def.yaml
PASS - def.yaml contains a valid Service
error:
kubectl apply -f def.yaml
error: error when retrieving current configuration of:
Resource: "/v1, Resource=services", GroupVersionKind: "/v1, Kind=Service"
Name: "", Namespace: "default"
Object: &{map["apiVersion":"v1" "kind":"Service" "metadata":map["annotations":map["kubectl.kubernetes.io/last-applied-configuration":""] "labels":map["app":"my-service"] "name":<nil> "namespace":"default"] "spec":map["ports":[map["name":"http" "port":'\u1239' "protocol":"TCP" "targetPort":'\u1239']] "selector":map["app":"my-service"] "type":"ClusterIP"]]}
from server for: "def.yaml": resource name may not be empty
Hello! Unfortunately I encountered the same problem. Any news about this? Maybe @rbrndt you solve this problem?
Any advices appreciated! Thanks!