Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to examples/yaml_dir/nginx-deployment. #2360

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ target/
.idea/*
*.iml
.vscode
test-requirements.txt
35 changes: 33 additions & 2 deletions examples/yaml_dir/nginx-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,49 @@ metadata:
name: nginx-deployment
labels:
app: nginx

spec:
replicas: 3
replicas: 5
selector:
matchLabels:
app: nginx

template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.15.4
image: nginx:1.23.3
ports:
- containerPort: 80


livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 5
periodSeconds: 10


readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 3
periodSeconds: 5


resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "250m"
memory: "256Mi"

env:
- name: WELCOME_MESSAGE
value: "Hello from Kubernetes!"
20 changes: 20 additions & 0 deletions kubernetes/test/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from kubernetes import client, config

# Load kubeconfig (Ensure you have access to a cluster)
config.load_kube_config()

# Create API client
v1 = client.CoreV1Api()

# Fetch pods
pods = v1.list_pod_for_all_namespaces()

# Debugging: Print the total number of pods
print(f"Total pods found: {len(pods.items)}")

# Iterate only if there are pods
if pods.items:
for pod in pods.items:
print(f"Pod: {pod.metadata.name}, Namespace: {pod.metadata.namespace}")
else:
print("No pods found.")
10 changes: 5 additions & 5 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
coverage>=4.0.3
nose>=1.3.7
coverage
nose
pytest
pytest-cov
pluggy>=0.3.1
randomize>=0.13
sphinx>=1.4 # BSD
pluggy
randomize
sphinx# BSD
recommonmark
sphinx_markdown_tables
pycodestyle
Expand Down
Loading