Closed
Description
What happened (please include outputs or screenshots):
Output:
Traceback (most recent call last):
File "test.py", line 8, in <module>
namespace="default", verbose=True)
File "/home/hhaecker/virtualenvs/test/lib/python3.7/site-packages/kubernetes/utils/create_from_yaml.py", line 89, in create_from_yaml
k8s_client, yml_document, verbose, namespace, **kwargs)
File "/home/hhaecker/virtualenvs/test/lib/python3.7/site-packages/kubernetes/utils/create_from_yaml.py", line 131, in create_from_yaml_single_item
print("{0} created. status='{1}'".format(kind, str(resp.status)))
AttributeError: 'V1NetworkPolicy' object has no attribute 'status'
What you expected to happen:
Proper confirmation log message for the creation of the NetworkPolicy and no crash.
How to reproduce it (as minimally and precisely as possible):
Use the following two files:
test.py
from kubernetes import client, config, utils
namespace = "01-deny-all"
config.load_kube_config()
k8s_client = client.ApiClient()
corev1 = client.CoreV1Api()
# utils.create_from_yaml = create_from_yaml
utils.create_from_yaml(k8s_client, "e2e-manifests/01-deny-all-traffic-to-an-application.yml",
namespace=namespace, verbose=True)
policy.yml
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
namespace: default
name: web-deny-all
spec:
podSelector:
matchLabels:
app: web
ingress: []
Anything else we need to know?:
Environment:
python kubernetes client 10.0.1
Python 3.7.2
kubernetes v1.13.3