diff --git a/.readthedocs.yaml b/.readthedocs.yaml deleted file mode 100644 index d220507cec..0000000000 --- a/.readthedocs.yaml +++ /dev/null @@ -1,53 +0,0 @@ -# Read the Docs configuration file for Sphinx projects -# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details - -# Required -version: 2 - -# Set the OS, Python version and other tools you might need -build: - os: ubuntu-22.04 - tools: - python: "3.12" - # You can also specify other tool versions: - # nodejs: "20" - # rust: "1.70" - # golang: "1.20" - -# Build documentation in the "docs/" directory with Sphinx -sphinx: - configuration: doc/source/conf.py - # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs - # builder: "dirhtml" - # Fail on all warnings to avoid broken references - # fail_on_warning: true - -# Optionally build your docs in additional formats such as PDF and ePub -# formats: -# - pdf -# - epub - -# Optional but recommended, declare the Python requirements required -# to build your documentation -# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html -python: - install: - - requirements: doc/requirements-docs.txt - - requirements: test-requirements.txt - - -# git clone --depth 1 https://github.com/kubernetes-client/python . -# git fetch origin --force --prune --prune-tags --depth 50 refs/heads/master:refs/remotes/origin/master -# git checkout --force origin/master -# git clean -d -f -f -# python3.7 -mvirtualenv $READTHEDOCS_VIRTUALENV_PATH -# python -m pip install --upgrade --no-cache-dir pip setuptools -# python -m pip install --upgrade --no-cache-dir pillow mock==1.0.1 alabaster>=0.7,<0.8,!=0.7.5 commonmark==0.9.1 recommonmark==0.5.0 sphinx<2 sphinx-rtd-theme<0.5 readthedocs-sphinx-ext<2.3 jinja2<3.1.0 - -# cat doc/source/conf.py -# python -m sphinx -T -E -b html -d _build/doctrees -D language=en . $READTHEDOCS_OUTPUT/html -# python -m sphinx -T -E -b readthedocssinglehtmllocalmedia -d _build/doctrees -D language=en . $READTHEDOCS_OUTPUT/htmlzip -# python -m sphinx -T -E -b latex -d _build/doctrees -D language=en . $READTHEDOCS_OUTPUT/pdf -# cat latexmkrc -# latexmk -r latexmkrc -pdf -f -dvi- -ps- -jobname=kubernetes -interaction=nonstopmode -# python -m sphinx -T -E -b epub -d _build/doctrees -D language=en . $READTHEDOCS_OUTPUT/epub \ No newline at end of file diff --git a/devel/debug_logging.md b/devel/debug_logging.md deleted file mode 100644 index 966e3d38e4..0000000000 --- a/devel/debug_logging.md +++ /dev/null @@ -1,34 +0,0 @@ -# Enabling Debug Logging in Kubernetes Python Client - -This document describes how to enable debug logging, view logged information, and provides examples for creating, patching, and deleting Kubernetes resources. - -## 1. Why Enable Debug Logging? - -Debug logging is useful for troubleshooting as it shows details like HTTP request and response headers and bodies. These details can help identify issues during interactions with the Kubernetes API server. - ---- - -## 2. Enabling Debug Logging - -To enable debug logging in the Kubernetes Python client, follow these steps: - -1. **Modify the Configuration Object:** - Enable debug mode by setting the `debug` attribute of the `client.Configuration` object to `True`. - -2. **Example Code to Enable Debug Logging:** - Below is an example showing how to enable debug logging: - ```python - from kubernetes import client, config - - # Load kube config - config.load_kube_config() - - # Enable debug logging - c = client.Configuration() - c.debug = True - - # Pass the updated configuration to the API client - api_client = client.ApiClient(configuration=c) - - # Use the API client with debug logging enabled - apps_v1 = client.AppsV1Api(api_client=api_client) diff --git a/examples/enable_debug_logging.py b/examples/enable_debug_logging.py deleted file mode 100644 index 573948f3c1..0000000000 --- a/examples/enable_debug_logging.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright 2025 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# This example demonstrates how to enable debug logging in the Kubernetes -# Python client and how it can be used for troubleshooting requests/responses. - -from kubernetes import client, config - - -def main(): - # Load kubeconfig from default location - config.load_kube_config() - - # Enable debug logging - configuration = client.Configuration() - configuration.debug = True - api_client = client.ApiClient(configuration=configuration) - - # Use AppsV1Api with debug logging enabled - apps_v1 = client.AppsV1Api(api_client=api_client) - - # Example: Create a dummy deployment (adjust namespace as needed) - deployment = client.V1Deployment( - api_version="apps/v1", - kind="Deployment", - metadata=client.V1ObjectMeta(name="debug-example"), - spec=client.V1DeploymentSpec( - replicas=1, - selector={"matchLabels": {"app": "debug"}}, - template=client.V1PodTemplateSpec( - metadata=client.V1ObjectMeta(labels={"app": "debug"}), - spec=client.V1PodSpec( - containers=[ - client.V1Container( - name="busybox", - image="busybox", - command=["sh", "-c", "echo Hello, Kubernetes! && sleep 3600"] - ) - ] - ), - ), - ), - ) - - # Create the deployment - try: - print("[INFO] Creating deployment...") - apps_v1.create_namespaced_deployment( - namespace="default", body=deployment - ) - except client.exceptions.ApiException as e: - print("[ERROR] Exception occurred:", e) - - -if __name__ == "__main__": - main() diff --git a/kubernetes/client/api_client.py b/kubernetes/client/api_client.py index 29863f5422..a6df401669 100644 --- a/kubernetes/client/api_client.py +++ b/kubernetes/client/api_client.py @@ -261,7 +261,14 @@ def deserialize(self, response, response_type): except ValueError: data = response.data - return self.__deserialize(data, response_type) + result = self.__deserialize(data, response_type) + if response_type == "V1PodList": + for pod in result.items: + if pod.metadata and pod.metadata.deletion_timestamp: + pod.status.phase = "Terminating" + + print(result) + return result def __deserialize(self, data, klass): """Deserializes dict, list, str into an object.