Skip to content
This repository was archived by the owner on Oct 3, 2020. It is now read-only.

Commit 46f2738

Browse files
committed
use from_env() in docs
1 parent 0502a29 commit 46f2738

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Query for all ready pods in a custom namespace:
8181
import operator
8282
import pykube
8383
84-
api = pykube.HTTPClient(pykube.KubeConfig.from_file("~/.kube/config"))
84+
api = pykube.HTTPClient(pykube.KubeConfig.from_file())
8585
pods = pykube.Pod.objects(api).filter(namespace="gondor-system")
8686
ready_pods = filter(operator.attrgetter("ready"), pods)
8787

docs/howtos/write-an-operator.rst

+3-7
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ Pykube can be used to implement Kubernetes Operators. Here is how to write a ver
99
import pykube, time
1010
1111
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()
1814
api = pykube.HTTPClient(config)
1915
for deploy in pykube.Deployment.objects(api, namespace=pykube.all):
2016
if 'pykube-test-operator' in deploy.annotations:
@@ -51,7 +47,7 @@ Create a ``Dockerfile`` in the same directory as ``main.py``:
5147

5248
.. code-block:: Dockerfile
5349
54-
FROM python:3.7-alpine3.9
50+
FROM python:3.7-alpine3.10
5551
5652
WORKDIR /
5753

0 commit comments

Comments
 (0)