This repository was archived by the owner on Oct 3, 2020. It is now read-only.
File tree 2 files changed +4
-8
lines changed
2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ Query for all ready pods in a custom namespace:
81
81
import operator
82
82
import pykube
83
83
84
- api = pykube.HTTPClient(pykube.KubeConfig.from_file(" ~/.kube/config " ))
84
+ api = pykube.HTTPClient(pykube.KubeConfig.from_file ())
85
85
pods = pykube.Pod.objects(api).filter(namespace=" gondor-system" )
86
86
ready_pods = filter(operator.attrgetter(" ready" ), pods)
87
87
Original file line number Diff line number Diff line change @@ -9,12 +9,8 @@ Pykube can be used to implement Kubernetes Operators. Here is how to write a ver
9
9
import pykube, time
10
10
11
11
while True :
12
- try :
13
- # running in cluster
14
- config = pykube.KubeConfig.from_service_account()
15
- except FileNotFoundError :
16
- # not running in cluster => load local ~/.kube/config for testing
17
- config = pykube.KubeConfig.from_file()
12
+ # loads in-cluster auth or local ~/.kube/config for testing
13
+ config = pykube.KubeConfig.from_env()
18
14
api = pykube.HTTPClient(config)
19
15
for deploy in pykube.Deployment.objects(api, namespace = pykube.all):
20
16
if ' pykube-test-operator' in deploy.annotations:
@@ -51,7 +47,7 @@ Create a ``Dockerfile`` in the same directory as ``main.py``:
51
47
52
48
.. code-block :: Dockerfile
53
49
54
- FROM python:3.7-alpine3.9
50
+ FROM python:3.7-alpine3.10
55
51
56
52
WORKDIR /
57
53
You can’t perform that action at this time.
0 commit comments