kontena / k8s-client

Ruby Kubernetes API client
Apache License 2.0
76 stars 26 forks source link

Fix resource default namespacing #33

Closed SpComb closed 5 years ago

SpComb commented 6 years ago

Fixes #32 to create resources in the config.context.namespace if the resource YAML for a namespaced resource is missing the metadata.namespace

SpComb commented 6 years ago

This is a slightly more complex change to the behavior of the K8s::ResourceClient, and I'm not 100% sure if it's entirely correct yet... the changes to client.create_resource and client.get_resources have specs which might be enough to cover the stack apply case, but it still needs more testing..

SpComb commented 6 years ago

Tested that --namespace=... works correctly with a stack apply/prune... changing the default namespace creates a new resource in the new namespace and prunes the old resource in the old namespace:

$ k8s-client --debug --kubeconfig .kube/test --prefetch-resources --stack spec/fixtures/resources/test/ --stack-name=test --prune-stack
I, [2018-08-24T11:02:53.256876 #1]  INFO -- K8s::Transport: Using config with server=https://167.99.39.233:6443
I, [2018-08-24T11:02:53.480523 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /version => HTTP 200: <K8s::API::Version> in 0.223s
I, [2018-08-24T11:02:53.480753 #1]  INFO -- : Kube server version: v1.11.1
I, [2018-08-24T11:02:53.537214 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /apis => HTTP 200: <K8s::API::MetaV1::APIGroupList> in 0.050s
I, [2018-08-24T11:02:53.678950 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /api/v1, GET /apis/apiregistration.k8s.io/v1, GET /apis/apiregistration.k8s.io/v1beta1, GET /apis/extensions/v1beta1, GET /apis/apps/v1, GET /apis/apps/v1beta2, GET /apis/apps/v1beta1, GET /apis/events.k8s.io/v1beta1, GET /apis/authentication.k8s.io/v1, GET /apis/authentication.k8s.io/v1beta1, GET /apis/authorization.k8s.io/v1, GET /apis/authorization.k8s.io/v1beta1, GET /apis/autoscaling/v1, GET /apis/autoscaling/v2beta1, GET /apis/batch/v1, GET /apis/batch/v1beta1, GET /apis/certificates.k8s.io/v1beta1, GET /apis/networking.k8s.io/v1, GET /apis/policy/v1beta1, GET /apis/rbac.authorization.k8s.io/v1, GET /apis/rbac.authorization.k8s.io/v1beta1, GET /apis/storage.k8s.io/v1, GET /apis/storage.k8s.io/v1beta1, GET /apis/admissionregistration.k8s.io/v1beta1, GET /apis/apiextensions.k8s.io/v1beta1, GET /apis/scheduling.k8s.io/v1beta1, GET /apis/certmanager.k8s.io/v1alpha1, GET /apis/metrics.k8s.io/v1beta1] => HTTP [200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200] in 0.122s
I, [2018-08-24T11:02:53.679132 #1]  INFO -- : Apply stack test...
I, [2018-08-24T11:02:53.727698 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /apis/pharos-test.k8s.io/v0] => HTTP [404] in 0.048s
I, [2018-08-24T11:02:53.794464 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/tests.pharos-test.k8s.io] => HTTP [404] in 0.066s
I, [2018-08-24T11:02:53.794691 #1]  INFO -- K8s::Stack<test>: Create resource apiextensions.k8s.io/v1beta1:CustomResourceDefinition/tests.pharos-test.k8s.io in namespace  with checksum=0e088994b20d89cb50f067bbc01c9560
I, [2018-08-24T11:02:53.858382 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: POST /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions <K8s::Resource> => HTTP 201: <K8s::Resource> in 0.063s
I, [2018-08-24T11:02:53.858632 #1]  INFO -- K8s::Stack<test>: Create resource pharos-test.k8s.io/v0:Test/test in namespace  with checksum=0e088994b20d89cb50f067bbc01c9560
I, [2018-08-24T11:02:53.911791 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /apis/pharos-test.k8s.io/v0 => HTTP 200: <K8s::API::MetaV1::APIResourceList> in 0.052s
I, [2018-08-24T11:02:54.011655 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: POST /apis/pharos-test.k8s.io/v0/namespaces/default/tests <K8s::Resource> => HTTP 201: <K8s::Resource> in 0.099s
W, [2018-08-24T11:02:54.539134 #1]  WARN -- K8s::Transport<https://167.99.39.233:6443>: Retry GET /apis/metrics.k8s.io/v1beta1/nodes => HTTP 503 Service Unavailable: Error: 'context canceled'
Trying to reach: 'https://10.250.74.147:443/apis/metrics.k8s.io/v1beta1/nodes?labelSelector=k8s.kontena.io%2Fstack%3Dtest' in 0.503s
I, [2018-08-24T11:02:54.589924 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /apis/metrics.k8s.io/v1beta1/nodes?labelSelector=k8s.kontena.io%2Fstack%3Dtest => HTTP 200: <K8s::API::MetaV1::List> in 0.050s
I, [2018-08-24T11:02:54.591353 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /api/v1/componentstatuses, GET /api/v1/configmaps, GET /api/v1/endpoints, GET /api/v1/events, GET /api/v1/limitranges, GET /api/v1/namespaces, GET /api/v1/nodes, GET /api/v1/persistentvolumeclaims, GET /api/v1/persistentvolumes, GET /api/v1/pods, GET /api/v1/podtemplates, GET /api/v1/replicationcontrollers, GET /api/v1/resourcequotas, GET /api/v1/secrets, GET /api/v1/serviceaccounts, GET /api/v1/services, GET /apis/apiregistration.k8s.io/v1/apiservices, GET /apis/apiregistration.k8s.io/v1beta1/apiservices, GET /apis/extensions/v1beta1/daemonsets, GET /apis/extensions/v1beta1/deployments, GET /apis/extensions/v1beta1/ingresses, GET /apis/extensions/v1beta1/networkpolicies, GET /apis/extensions/v1beta1/podsecuritypolicies, GET /apis/extensions/v1beta1/replicasets, GET /apis/apps/v1/controllerrevisions, GET /apis/apps/v1/daemonsets, GET /apis/apps/v1/deployments, GET /apis/apps/v1/replicasets, GET /apis/apps/v1/statefulsets, GET /apis/apps/v1beta2/controllerrevisions, GET /apis/apps/v1beta2/daemonsets, GET /apis/apps/v1beta2/deployments, GET /apis/apps/v1beta2/replicasets, GET /apis/apps/v1beta2/statefulsets, GET /apis/apps/v1beta1/controllerrevisions, GET /apis/apps/v1beta1/deployments, GET /apis/apps/v1beta1/statefulsets, GET /apis/events.k8s.io/v1beta1/events, GET /apis/autoscaling/v1/horizontalpodautoscalers, GET /apis/autoscaling/v2beta1/horizontalpodautoscalers, GET /apis/batch/v1/jobs, GET /apis/batch/v1beta1/cronjobs, GET /apis/certificates.k8s.io/v1beta1/certificatesigningrequests, GET /apis/networking.k8s.io/v1/networkpolicies, GET /apis/policy/v1beta1/poddisruptionbudgets, GET /apis/policy/v1beta1/podsecuritypolicies, GET /apis/rbac.authorization.k8s.io/v1/clusterrolebindings, GET /apis/rbac.authorization.k8s.io/v1/clusterroles, GET /apis/rbac.authorization.k8s.io/v1/rolebindings, GET /apis/rbac.authorization.k8s.io/v1/roles, GET /apis/rbac.authorization.k8s.io/v1beta1/clusterrolebindings, GET /apis/rbac.authorization.k8s.io/v1beta1/clusterroles, GET /apis/rbac.authorization.k8s.io/v1beta1/rolebindings, GET /apis/rbac.authorization.k8s.io/v1beta1/roles, GET /apis/storage.k8s.io/v1/storageclasses, GET /apis/storage.k8s.io/v1beta1/storageclasses, GET /apis/storage.k8s.io/v1beta1/volumeattachments, GET /apis/admissionregistration.k8s.io/v1beta1/mutatingwebhookconfigurations, GET /apis/admissionregistration.k8s.io/v1beta1/validatingwebhookconfigurations, GET /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions, GET /apis/scheduling.k8s.io/v1beta1/priorityclasses, GET /apis/certmanager.k8s.io/v1alpha1/issuers, GET /apis/certmanager.k8s.io/v1alpha1/certificates, GET /apis/certmanager.k8s.io/v1alpha1/clusterissuers, GET /apis/metrics.k8s.io/v1beta1/nodes, GET /apis/metrics.k8s.io/v1beta1/pods] => HTTP [200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 503, 200] in 0.503s
D, [2018-08-24T11:02:54.594310 #1] DEBUG -- K8s::Stack<test>: List resource apiextensions.k8s.io/v1beta1:CustomResourceDefinition/tests.pharos-test.k8s.io in namespace  with checksum=0e088994b20d89cb50f067bbc01c9560
$ k8s-client --debug --kubeconfig .kube/test --prefetch-resources --stack spec/fixtures/resources/test/ --stack-name=test --prune-stack 
I, [2018-08-24T11:03:01.395311 #1]  INFO -- K8s::Transport: Using config with server=https://167.99.39.233:6443
I, [2018-08-24T11:03:01.623677 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /version => HTTP 200: <K8s::API::Version> in 0.228s
I, [2018-08-24T11:03:01.623881 #1]  INFO -- : Kube server version: v1.11.1
I, [2018-08-24T11:03:01.679731 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /apis => HTTP 200: <K8s::API::MetaV1::APIGroupList> in 0.049s
I, [2018-08-24T11:03:01.813607 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /api/v1, GET /apis/apiregistration.k8s.io/v1, GET /apis/apiregistration.k8s.io/v1beta1, GET /apis/extensions/v1beta1, GET /apis/apps/v1, GET /apis/apps/v1beta2, GET /apis/apps/v1beta1, GET /apis/events.k8s.io/v1beta1, GET /apis/authentication.k8s.io/v1, GET /apis/authentication.k8s.io/v1beta1, GET /apis/authorization.k8s.io/v1, GET /apis/authorization.k8s.io/v1beta1, GET /apis/autoscaling/v1, GET /apis/autoscaling/v2beta1, GET /apis/batch/v1, GET /apis/batch/v1beta1, GET /apis/certificates.k8s.io/v1beta1, GET /apis/networking.k8s.io/v1, GET /apis/policy/v1beta1, GET /apis/rbac.authorization.k8s.io/v1, GET /apis/rbac.authorization.k8s.io/v1beta1, GET /apis/storage.k8s.io/v1, GET /apis/storage.k8s.io/v1beta1, GET /apis/admissionregistration.k8s.io/v1beta1, GET /apis/apiextensions.k8s.io/v1beta1, GET /apis/scheduling.k8s.io/v1beta1, GET /apis/pharos-test.k8s.io/v0, GET /apis/certmanager.k8s.io/v1alpha1, GET /apis/metrics.k8s.io/v1beta1] => HTTP [200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200] in 0.119s
I, [2018-08-24T11:03:01.813729 #1]  INFO -- : Apply stack test...
I, [2018-08-24T11:03:01.910613 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/tests.pharos-test.k8s.io, GET /apis/pharos-test.k8s.io/v0/namespaces/default/tests/test] => HTTP [200, 200] in 0.095s
I, [2018-08-24T11:03:01.911838 #1]  INFO -- K8s::Stack<test>: Keep resource apiextensions.k8s.io/v1beta1:CustomResourceDefinition/tests.pharos-test.k8s.io in namespace  with checksum=0e088994b20d89cb50f067bbc01c9560
I, [2018-08-24T11:03:01.912528 #1]  INFO -- K8s::Stack<test>: Keep resource pharos-test.k8s.io/v0:Test/test in namespace  with checksum=0e088994b20d89cb50f067bbc01c9560
W, [2018-08-24T11:03:02.380796 #1]  WARN -- K8s::Transport<https://167.99.39.233:6443>: Retry GET /apis/metrics.k8s.io/v1beta1/nodes => HTTP 503 Service Unavailable: Error: 'context canceled'
Trying to reach: 'https://10.250.74.147:443/apis/metrics.k8s.io/v1beta1/nodes?labelSelector=k8s.kontena.io%2Fstack%3Dtest' in 0.448s
I, [2018-08-24T11:03:02.429553 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /apis/metrics.k8s.io/v1beta1/nodes?labelSelector=k8s.kontena.io%2Fstack%3Dtest => HTTP 200: <K8s::API::MetaV1::List> in 0.048s
I, [2018-08-24T11:03:02.431318 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /api/v1/componentstatuses, GET /api/v1/configmaps, GET /api/v1/endpoints, GET /api/v1/events, GET /api/v1/limitranges, GET /api/v1/namespaces, GET /api/v1/nodes, GET /api/v1/persistentvolumeclaims, GET /api/v1/persistentvolumes, GET /api/v1/pods, GET /api/v1/podtemplates, GET /api/v1/replicationcontrollers, GET /api/v1/resourcequotas, GET /api/v1/secrets, GET /api/v1/serviceaccounts, GET /api/v1/services, GET /apis/apiregistration.k8s.io/v1/apiservices, GET /apis/apiregistration.k8s.io/v1beta1/apiservices, GET /apis/extensions/v1beta1/daemonsets, GET /apis/extensions/v1beta1/deployments, GET /apis/extensions/v1beta1/ingresses, GET /apis/extensions/v1beta1/networkpolicies, GET /apis/extensions/v1beta1/podsecuritypolicies, GET /apis/extensions/v1beta1/replicasets, GET /apis/apps/v1/controllerrevisions, GET /apis/apps/v1/daemonsets, GET /apis/apps/v1/deployments, GET /apis/apps/v1/replicasets, GET /apis/apps/v1/statefulsets, GET /apis/apps/v1beta2/controllerrevisions, GET /apis/apps/v1beta2/daemonsets, GET /apis/apps/v1beta2/deployments, GET /apis/apps/v1beta2/replicasets, GET /apis/apps/v1beta2/statefulsets, GET /apis/apps/v1beta1/controllerrevisions, GET /apis/apps/v1beta1/deployments, GET /apis/apps/v1beta1/statefulsets, GET /apis/events.k8s.io/v1beta1/events, GET /apis/autoscaling/v1/horizontalpodautoscalers, GET /apis/autoscaling/v2beta1/horizontalpodautoscalers, GET /apis/batch/v1/jobs, GET /apis/batch/v1beta1/cronjobs, GET /apis/certificates.k8s.io/v1beta1/certificatesigningrequests, GET /apis/networking.k8s.io/v1/networkpolicies, GET /apis/policy/v1beta1/poddisruptionbudgets, GET /apis/policy/v1beta1/podsecuritypolicies, GET /apis/rbac.authorization.k8s.io/v1/clusterrolebindings, GET /apis/rbac.authorization.k8s.io/v1/clusterroles, GET /apis/rbac.authorization.k8s.io/v1/rolebindings, GET /apis/rbac.authorization.k8s.io/v1/roles, GET /apis/rbac.authorization.k8s.io/v1beta1/clusterrolebindings, GET /apis/rbac.authorization.k8s.io/v1beta1/clusterroles, GET /apis/rbac.authorization.k8s.io/v1beta1/rolebindings, GET /apis/rbac.authorization.k8s.io/v1beta1/roles, GET /apis/storage.k8s.io/v1/storageclasses, GET /apis/storage.k8s.io/v1beta1/storageclasses, GET /apis/storage.k8s.io/v1beta1/volumeattachments, GET /apis/admissionregistration.k8s.io/v1beta1/mutatingwebhookconfigurations, GET /apis/admissionregistration.k8s.io/v1beta1/validatingwebhookconfigurations, GET /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions, GET /apis/scheduling.k8s.io/v1beta1/priorityclasses, GET /apis/pharos-test.k8s.io/v0/tests, GET /apis/certmanager.k8s.io/v1alpha1/issuers, GET /apis/certmanager.k8s.io/v1alpha1/certificates, GET /apis/certmanager.k8s.io/v1alpha1/clusterissuers, GET /apis/metrics.k8s.io/v1beta1/nodes, GET /apis/metrics.k8s.io/v1beta1/pods] => HTTP [200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 503, 200] in 0.448s
D, [2018-08-24T11:03:02.434160 #1] DEBUG -- K8s::Stack<test>: List resource apiextensions.k8s.io/v1beta1:CustomResourceDefinition/tests.pharos-test.k8s.io in namespace  with checksum=0e088994b20d89cb50f067bbc01c9560
D, [2018-08-24T11:03:02.435074 #1] DEBUG -- K8s::Stack<test>: List resource pharos-test.k8s.io/v0:Test/test in namespace default with checksum=0e088994b20d89cb50f067bbc01c9560
$ k8s-client --debug --kubeconfig .kube/test --prefetch-resources --stack spec/fixtures/resources/test/ --stack-name=test --prune-stack  --namespace=test
I, [2018-08-24T11:03:14.202350 #1]  INFO -- K8s::Transport: Using config with server=https://167.99.39.233:6443
I, [2018-08-24T11:03:14.421225 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /version => HTTP 200: <K8s::API::Version> in 0.218s
I, [2018-08-24T11:03:14.421434 #1]  INFO -- : Kube server version: v1.11.1
I, [2018-08-24T11:03:14.480128 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /apis => HTTP 200: <K8s::API::MetaV1::APIGroupList> in 0.051s
I, [2018-08-24T11:03:14.617489 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /api/v1, GET /apis/apiregistration.k8s.io/v1, GET /apis/apiregistration.k8s.io/v1beta1, GET /apis/extensions/v1beta1, GET /apis/apps/v1, GET /apis/apps/v1beta2, GET /apis/apps/v1beta1, GET /apis/events.k8s.io/v1beta1, GET /apis/authentication.k8s.io/v1, GET /apis/authentication.k8s.io/v1beta1, GET /apis/authorization.k8s.io/v1, GET /apis/authorization.k8s.io/v1beta1, GET /apis/autoscaling/v1, GET /apis/autoscaling/v2beta1, GET /apis/batch/v1, GET /apis/batch/v1beta1, GET /apis/certificates.k8s.io/v1beta1, GET /apis/networking.k8s.io/v1, GET /apis/policy/v1beta1, GET /apis/rbac.authorization.k8s.io/v1, GET /apis/rbac.authorization.k8s.io/v1beta1, GET /apis/storage.k8s.io/v1, GET /apis/storage.k8s.io/v1beta1, GET /apis/admissionregistration.k8s.io/v1beta1, GET /apis/apiextensions.k8s.io/v1beta1, GET /apis/scheduling.k8s.io/v1beta1, GET /apis/pharos-test.k8s.io/v0, GET /apis/certmanager.k8s.io/v1alpha1, GET /apis/metrics.k8s.io/v1beta1] => HTTP [200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200] in 0.120s
I, [2018-08-24T11:03:14.617621 #1]  INFO -- : Apply stack test...
I, [2018-08-24T11:03:14.718516 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/tests.pharos-test.k8s.io, GET /apis/pharos-test.k8s.io/v0/namespaces/test/tests/test] => HTTP [200, 404] in 0.099s
I, [2018-08-24T11:03:14.721753 #1]  INFO -- K8s::Stack<test>: Keep resource apiextensions.k8s.io/v1beta1:CustomResourceDefinition/tests.pharos-test.k8s.io in namespace  with checksum=0e088994b20d89cb50f067bbc01c9560
I, [2018-08-24T11:03:14.722531 #1]  INFO -- K8s::Stack<test>: Create resource pharos-test.k8s.io/v0:Test/test in namespace  with checksum=883264f62738353c49411a581cf41cc2
I, [2018-08-24T11:03:14.787570 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: POST /apis/pharos-test.k8s.io/v0/namespaces/test/tests <K8s::Resource> => HTTP 201: <K8s::Resource> in 0.061s
W, [2018-08-24T11:03:15.544539 #1]  WARN -- K8s::Transport<https://167.99.39.233:6443>: Retry GET /apis/metrics.k8s.io/v1beta1/nodes => HTTP 503 Service Unavailable: Error: 'context canceled'
Trying to reach: 'https://10.250.74.147:443/apis/metrics.k8s.io/v1beta1/nodes?labelSelector=k8s.kontena.io%2Fstack%3Dtest' in 0.728s
I, [2018-08-24T11:03:15.601344 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /apis/metrics.k8s.io/v1beta1/nodes?labelSelector=k8s.kontena.io%2Fstack%3Dtest => HTTP 200: <K8s::API::MetaV1::List> in 0.056s
I, [2018-08-24T11:03:15.602543 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /api/v1/componentstatuses, GET /api/v1/configmaps, GET /api/v1/endpoints, GET /api/v1/events, GET /api/v1/limitranges, GET /api/v1/namespaces, GET /api/v1/nodes, GET /api/v1/persistentvolumeclaims, GET /api/v1/persistentvolumes, GET /api/v1/pods, GET /api/v1/podtemplates, GET /api/v1/replicationcontrollers, GET /api/v1/resourcequotas, GET /api/v1/secrets, GET /api/v1/serviceaccounts, GET /api/v1/services, GET /apis/apiregistration.k8s.io/v1/apiservices, GET /apis/apiregistration.k8s.io/v1beta1/apiservices, GET /apis/extensions/v1beta1/daemonsets, GET /apis/extensions/v1beta1/deployments, GET /apis/extensions/v1beta1/ingresses, GET /apis/extensions/v1beta1/networkpolicies, GET /apis/extensions/v1beta1/podsecuritypolicies, GET /apis/extensions/v1beta1/replicasets, GET /apis/apps/v1/controllerrevisions, GET /apis/apps/v1/daemonsets, GET /apis/apps/v1/deployments, GET /apis/apps/v1/replicasets, GET /apis/apps/v1/statefulsets, GET /apis/apps/v1beta2/controllerrevisions, GET /apis/apps/v1beta2/daemonsets, GET /apis/apps/v1beta2/deployments, GET /apis/apps/v1beta2/replicasets, GET /apis/apps/v1beta2/statefulsets, GET /apis/apps/v1beta1/controllerrevisions, GET /apis/apps/v1beta1/deployments, GET /apis/apps/v1beta1/statefulsets, GET /apis/events.k8s.io/v1beta1/events, GET /apis/autoscaling/v1/horizontalpodautoscalers, GET /apis/autoscaling/v2beta1/horizontalpodautoscalers, GET /apis/batch/v1/jobs, GET /apis/batch/v1beta1/cronjobs, GET /apis/certificates.k8s.io/v1beta1/certificatesigningrequests, GET /apis/networking.k8s.io/v1/networkpolicies, GET /apis/policy/v1beta1/poddisruptionbudgets, GET /apis/policy/v1beta1/podsecuritypolicies, GET /apis/rbac.authorization.k8s.io/v1/clusterrolebindings, GET /apis/rbac.authorization.k8s.io/v1/clusterroles, GET /apis/rbac.authorization.k8s.io/v1/rolebindings, GET /apis/rbac.authorization.k8s.io/v1/roles, GET /apis/rbac.authorization.k8s.io/v1beta1/clusterrolebindings, GET /apis/rbac.authorization.k8s.io/v1beta1/clusterroles, GET /apis/rbac.authorization.k8s.io/v1beta1/rolebindings, GET /apis/rbac.authorization.k8s.io/v1beta1/roles, GET /apis/storage.k8s.io/v1/storageclasses, GET /apis/storage.k8s.io/v1beta1/storageclasses, GET /apis/storage.k8s.io/v1beta1/volumeattachments, GET /apis/admissionregistration.k8s.io/v1beta1/mutatingwebhookconfigurations, GET /apis/admissionregistration.k8s.io/v1beta1/validatingwebhookconfigurations, GET /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions, GET /apis/scheduling.k8s.io/v1beta1/priorityclasses, GET /apis/pharos-test.k8s.io/v0/tests, GET /apis/certmanager.k8s.io/v1alpha1/issuers, GET /apis/certmanager.k8s.io/v1alpha1/certificates, GET /apis/certmanager.k8s.io/v1alpha1/clusterissuers, GET /apis/metrics.k8s.io/v1beta1/nodes, GET /apis/metrics.k8s.io/v1beta1/pods] => HTTP [200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 503, 200] in 0.728s
D, [2018-08-24T11:03:15.604217 #1] DEBUG -- K8s::Stack<test>: List resource apiextensions.k8s.io/v1beta1:CustomResourceDefinition/tests.pharos-test.k8s.io in namespace  with checksum=0e088994b20d89cb50f067bbc01c9560
D, [2018-08-24T11:03:15.604795 #1] DEBUG -- K8s::Stack<test>: List resource pharos-test.k8s.io/v0:Test/test in namespace default with checksum=0e088994b20d89cb50f067bbc01c9560
I, [2018-08-24T11:03:15.604931 #1]  INFO -- K8s::Stack<test>: Delete resource pharos-test.k8s.io/v0:Test/test in namespace default
I, [2018-08-24T11:03:15.659600 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: DELETE /apis/pharos-test.k8s.io/v0/namespaces/default/tests/test => HTTP 200: <K8s::Resource> in 0.054s
D, [2018-08-24T11:03:15.660407 #1] DEBUG -- K8s::Stack<test>: List resource pharos-test.k8s.io/v0:Test/test in namespace test with checksum=883264f62738353c49411a581cf41cc2
$ k8s-client --debug --kubeconfig .kube/test --prefetch-resources --stack spec/fixtures/resources/test/ --stack-name=test --prune-stack  --namespace=test
I, [2018-08-24T11:04:39.217414 #1]  INFO -- K8s::Transport: Using config with server=https://167.99.39.233:6443
I, [2018-08-24T11:04:39.474929 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /version => HTTP 200: <K8s::API::Version> in 0.257s
I, [2018-08-24T11:04:39.475140 #1]  INFO -- : Kube server version: v1.11.1
I, [2018-08-24T11:04:39.529314 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /apis => HTTP 200: <K8s::API::MetaV1::APIGroupList> in 0.048s
I, [2018-08-24T11:04:39.667861 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /api/v1, GET /apis/apiregistration.k8s.io/v1, GET /apis/apiregistration.k8s.io/v1beta1, GET /apis/extensions/v1beta1, GET /apis/apps/v1, GET /apis/apps/v1beta2, GET /apis/apps/v1beta1, GET /apis/events.k8s.io/v1beta1, GET /apis/authentication.k8s.io/v1, GET /apis/authentication.k8s.io/v1beta1, GET /apis/authorization.k8s.io/v1, GET /apis/authorization.k8s.io/v1beta1, GET /apis/autoscaling/v1, GET /apis/autoscaling/v2beta1, GET /apis/batch/v1, GET /apis/batch/v1beta1, GET /apis/certificates.k8s.io/v1beta1, GET /apis/networking.k8s.io/v1, GET /apis/policy/v1beta1, GET /apis/rbac.authorization.k8s.io/v1, GET /apis/rbac.authorization.k8s.io/v1beta1, GET /apis/storage.k8s.io/v1, GET /apis/storage.k8s.io/v1beta1, GET /apis/admissionregistration.k8s.io/v1beta1, GET /apis/apiextensions.k8s.io/v1beta1, GET /apis/scheduling.k8s.io/v1beta1, GET /apis/pharos-test.k8s.io/v0, GET /apis/certmanager.k8s.io/v1alpha1, GET /apis/metrics.k8s.io/v1beta1] => HTTP [200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200] in 0.118s
I, [2018-08-24T11:04:39.667979 #1]  INFO -- : Apply stack test...
I, [2018-08-24T11:04:39.770183 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/tests.pharos-test.k8s.io, GET /apis/pharos-test.k8s.io/v0/namespaces/test/tests/test] => HTTP [200, 200] in 0.101s
I, [2018-08-24T11:04:39.773795 #1]  INFO -- K8s::Stack<test>: Keep resource apiextensions.k8s.io/v1beta1:CustomResourceDefinition/tests.pharos-test.k8s.io in namespace  with checksum=0e088994b20d89cb50f067bbc01c9560
I, [2018-08-24T11:04:39.775572 #1]  INFO -- K8s::Stack<test>: Keep resource pharos-test.k8s.io/v0:Test/test in namespace  with checksum=883264f62738353c49411a581cf41cc2
W, [2018-08-24T11:04:40.240665 #1]  WARN -- K8s::Transport<https://167.99.39.233:6443>: Retry GET /apis/metrics.k8s.io/v1beta1/nodes => HTTP 503 Service Unavailable: Error: 'context canceled'
Trying to reach: 'https://10.250.74.147:443/apis/metrics.k8s.io/v1beta1/nodes?labelSelector=k8s.kontena.io%2Fstack%3Dtest' in 0.441s
I, [2018-08-24T11:04:40.286468 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: GET /apis/metrics.k8s.io/v1beta1/nodes?labelSelector=k8s.kontena.io%2Fstack%3Dtest => HTTP 200: <K8s::API::MetaV1::List> in 0.045s
I, [2018-08-24T11:04:40.287124 #1]  INFO -- K8s::Transport<https://167.99.39.233:6443>: [GET /api/v1/componentstatuses, GET /api/v1/configmaps, GET /api/v1/endpoints, GET /api/v1/events, GET /api/v1/limitranges, GET /api/v1/namespaces, GET /api/v1/nodes, GET /api/v1/persistentvolumeclaims, GET /api/v1/persistentvolumes, GET /api/v1/pods, GET /api/v1/podtemplates, GET /api/v1/replicationcontrollers, GET /api/v1/resourcequotas, GET /api/v1/secrets, GET /api/v1/serviceaccounts, GET /api/v1/services, GET /apis/apiregistration.k8s.io/v1/apiservices, GET /apis/apiregistration.k8s.io/v1beta1/apiservices, GET /apis/extensions/v1beta1/daemonsets, GET /apis/extensions/v1beta1/deployments, GET /apis/extensions/v1beta1/ingresses, GET /apis/extensions/v1beta1/networkpolicies, GET /apis/extensions/v1beta1/podsecuritypolicies, GET /apis/extensions/v1beta1/replicasets, GET /apis/apps/v1/controllerrevisions, GET /apis/apps/v1/daemonsets, GET /apis/apps/v1/deployments, GET /apis/apps/v1/replicasets, GET /apis/apps/v1/statefulsets, GET /apis/apps/v1beta2/controllerrevisions, GET /apis/apps/v1beta2/daemonsets, GET /apis/apps/v1beta2/deployments, GET /apis/apps/v1beta2/replicasets, GET /apis/apps/v1beta2/statefulsets, GET /apis/apps/v1beta1/controllerrevisions, GET /apis/apps/v1beta1/deployments, GET /apis/apps/v1beta1/statefulsets, GET /apis/events.k8s.io/v1beta1/events, GET /apis/autoscaling/v1/horizontalpodautoscalers, GET /apis/autoscaling/v2beta1/horizontalpodautoscalers, GET /apis/batch/v1/jobs, GET /apis/batch/v1beta1/cronjobs, GET /apis/certificates.k8s.io/v1beta1/certificatesigningrequests, GET /apis/networking.k8s.io/v1/networkpolicies, GET /apis/policy/v1beta1/poddisruptionbudgets, GET /apis/policy/v1beta1/podsecuritypolicies, GET /apis/rbac.authorization.k8s.io/v1/clusterrolebindings, GET /apis/rbac.authorization.k8s.io/v1/clusterroles, GET /apis/rbac.authorization.k8s.io/v1/rolebindings, GET /apis/rbac.authorization.k8s.io/v1/roles, GET /apis/rbac.authorization.k8s.io/v1beta1/clusterrolebindings, GET /apis/rbac.authorization.k8s.io/v1beta1/clusterroles, GET /apis/rbac.authorization.k8s.io/v1beta1/rolebindings, GET /apis/rbac.authorization.k8s.io/v1beta1/roles, GET /apis/storage.k8s.io/v1/storageclasses, GET /apis/storage.k8s.io/v1beta1/storageclasses, GET /apis/storage.k8s.io/v1beta1/volumeattachments, GET /apis/admissionregistration.k8s.io/v1beta1/mutatingwebhookconfigurations, GET /apis/admissionregistration.k8s.io/v1beta1/validatingwebhookconfigurations, GET /apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions, GET /apis/scheduling.k8s.io/v1beta1/priorityclasses, GET /apis/pharos-test.k8s.io/v0/tests, GET /apis/certmanager.k8s.io/v1alpha1/issuers, GET /apis/certmanager.k8s.io/v1alpha1/certificates, GET /apis/certmanager.k8s.io/v1alpha1/clusterissuers, GET /apis/metrics.k8s.io/v1beta1/nodes, GET /apis/metrics.k8s.io/v1beta1/pods] => HTTP [200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 503, 200] in 0.441s
D, [2018-08-24T11:04:40.288236 #1] DEBUG -- K8s::Stack<test>: List resource apiextensions.k8s.io/v1beta1:CustomResourceDefinition/tests.pharos-test.k8s.io in namespace  with checksum=0e088994b20d89cb50f067bbc01c9560
D, [2018-08-24T11:04:40.288560 #1] DEBUG -- K8s::Stack<test>: List resource pharos-test.k8s.io/v0:Test/test in namespace test with checksum=883264f62738353c49411a581cf41cc2