diff --git a/.gitignore b/.gitignore index bdd5055d15..e14ad721a3 100644 --- a/.gitignore +++ b/.gitignore @@ -67,3 +67,4 @@ target/ .idea/* *.iml .vscode +test-requirements.txt diff --git a/examples/yaml_dir/nginx-deployment.yaml b/examples/yaml_dir/nginx-deployment.yaml index 5dd80da371..3c4ea6d0fa 100644 --- a/examples/yaml_dir/nginx-deployment.yaml +++ b/examples/yaml_dir/nginx-deployment.yaml @@ -4,11 +4,13 @@ metadata: name: nginx-deployment labels: app: nginx + spec: - replicas: 3 + replicas: 5 selector: matchLabels: app: nginx + template: metadata: labels: @@ -16,6 +18,35 @@ spec: 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!" diff --git a/kubernetes/test/test.py b/kubernetes/test/test.py new file mode 100644 index 0000000000..31a1d4eb89 --- /dev/null +++ b/kubernetes/test/test.py @@ -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.") diff --git a/test-requirements.txt b/test-requirements.txt index 668b82e2ec..c539a7fef5 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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