Skip to content

Commit 2e792cd

Browse files
committed
Update to Example Files
1 parent d80165d commit 2e792cd

File tree

4 files changed

+59
-7
lines changed

4 files changed

+59
-7
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,4 @@ target/
6767
.idea/*
6868
*.iml
6969
.vscode
70+
test-requirements.txt

examples/yaml_dir/nginx-deployment.yaml

+33-2
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,49 @@ metadata:
44
name: nginx-deployment
55
labels:
66
app: nginx
7+
78
spec:
8-
replicas: 3
9+
replicas: 5
910
selector:
1011
matchLabels:
1112
app: nginx
13+
1214
template:
1315
metadata:
1416
labels:
1517
app: nginx
1618
spec:
1719
containers:
1820
- name: nginx
19-
image: nginx:1.15.4
21+
image: nginx:1.23.3
2022
ports:
2123
- containerPort: 80
24+
25+
26+
livenessProbe:
27+
httpGet:
28+
path: /
29+
port: 80
30+
initialDelaySeconds: 5
31+
periodSeconds: 10
32+
33+
34+
readinessProbe:
35+
httpGet:
36+
path: /
37+
port: 80
38+
initialDelaySeconds: 3
39+
periodSeconds: 5
40+
41+
42+
resources:
43+
requests:
44+
cpu: "100m"
45+
memory: "128Mi"
46+
limits:
47+
cpu: "250m"
48+
memory: "256Mi"
49+
50+
env:
51+
- name: WELCOME_MESSAGE
52+
value: "Hello from Kubernetes!"

kubernetes/test/test.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from kubernetes import client, config
2+
3+
# Load kubeconfig (Ensure you have access to a cluster)
4+
config.load_kube_config()
5+
6+
# Create API client
7+
v1 = client.CoreV1Api()
8+
9+
# Fetch pods
10+
pods = v1.list_pod_for_all_namespaces()
11+
12+
# Debugging: Print the total number of pods
13+
print(f"Total pods found: {len(pods.items)}")
14+
15+
# Iterate only if there are pods
16+
if pods.items:
17+
for pod in pods.items:
18+
print(f"Pod: {pod.metadata.name}, Namespace: {pod.metadata.namespace}")
19+
else:
20+
print("No pods found.")

test-requirements.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
coverage>=4.0.3
2-
nose>=1.3.7
1+
coverage
2+
nose
33
pytest
44
pytest-cov
5-
pluggy>=0.3.1
6-
randomize>=0.13
7-
sphinx>=1.4 # BSD
5+
pluggy
6+
randomize
7+
sphinx# BSD
88
recommonmark
99
sphinx_markdown_tables
1010
pycodestyle

0 commit comments

Comments
 (0)