Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
6 changes: 4 additions & 2 deletions .github/workflows/test-kr8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
kubernetes-version: ["1.33.4"]
kubernetes-version: ["1.34.0"]
include:
- python-version: "3.14"
kubernetes-version: 1.33.4
- python-version: "3.14"
kubernetes-version: 1.32.8
- python-version: "3.14"
Expand Down Expand Up @@ -65,7 +67,7 @@ jobs:
matrix:
# Test the minimal and maximal Python versions only
python-version: ["3.9", "3.14"]
kubernetes-version: ["1.33.4"]
kubernetes-version: ["1.34.0"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-kubectl-ng.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
kubernetes-version: ["1.33.4"]
kubernetes-version: ["1.34.0"]
include:
- python-version: "3.14"
kubernetes-version: 1.33.4
- python-version: "3.14"
kubernetes-version: 1.32.8
- python-version: "3.14"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[![EffVer Versioning](https://img.shields.io/badge/version_scheme-EffVer-0097a7)](https://jacobtomlinson.dev/effver)
[![PyPI](https://img.shields.io/pypi/v/kr8s)](https://pypi.org/project/kr8s/)
[![Python Version Support](https://img.shields.io/badge/Python%20support-3.9%7C3.10%7C3.11%7C3.12%7C3.13%7C3.14-blue)](https://pypi.org/project/kr8s/)
[![Kubernetes Version Support](https://img.shields.io/badge/Kubernetes%20support-1.28%7C1.29%7C1.30%7C1.31%7C1.32%7C1.33-blue)](https://docs.kr8s.org/en/stable/installation.html#supported-kubernetes-versions)
[![Kubernetes Version Support](https://img.shields.io/badge/Kubernetes%20support-1.28%7C1.29%7C1.30%7C1.31%7C1.32%7C1.33%7C1.34-blue)](https://docs.kr8s.org/en/stable/installation.html#supported-kubernetes-versions)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/kr8s)](https://pypi.org/project/kr8s/)
[![PyPI - License](https://img.shields.io/pypi/l/kr8s)](https://pypi.org/project/kr8s/)

Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![EffVer Versioning](https://img.shields.io/badge/version_scheme-EffVer-0097a7)](https://jacobtomlinson.dev/effver)
[![PyPI](https://img.shields.io/pypi/v/kr8s)](https://pypi.org/project/kr8s/)
[![Python Version Support](https://img.shields.io/badge/Python%20support-3.9%7C3.10%7C3.11%7C3.12%7C3.13%7C3.14-blue)](https://pypi.org/project/kr8s/)
[![Kubernetes Version Support](https://img.shields.io/badge/Kubernetes%20support-1.28%7C1.29%7C1.30%7C1.31%7C1.32%7C1.33-blue)](https://docs.kr8s.org/en/stable/installation.html#supported-kubernetes-versions)
[![Kubernetes Version Support](https://img.shields.io/badge/Kubernetes%20support-1.28%7C1.29%7C1.30%7C1.31%7C1.32%7C1.33%7C1.34-blue)](https://docs.kr8s.org/en/stable/installation.html#supported-kubernetes-versions)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/kr8s)](https://pypi.org/project/kr8s/)
[![PyPI - License](https://img.shields.io/pypi/l/kr8s)](https://pypi.org/project/kr8s/)
<iframe src="https://ghbtns.com/github-btn.html?user=kr8s-org&repo=kr8s&type=star&count=true" frameborder="0" scrolling="0" width="150" height="20" title="GitHub"></iframe>
Expand Down
17 changes: 9 additions & 8 deletions kr8s/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,13 @@ def raw(self) -> dict:
data = {
"apiVersion": "v1",
"kind": "Config",
"preferences": self.preferences,
"clusters": self.clusters,
"users": self.users,
"contexts": self.contexts,
"current-context": self.current_context,
}
if self.preferences:
data["preferences"] = self.preferences # type: ignore[assignment]
if self.extensions:
data["extensions"] = self.extensions
return data
Expand Down Expand Up @@ -174,7 +175,7 @@ async def unset(self, pointer: str) -> None:
pass

@property
def preferences(self) -> list[dict]:
def preferences(self) -> dict:
return self._configs[0].preferences

@property
Expand Down Expand Up @@ -333,21 +334,21 @@ def raw(self) -> dict:
return self._raw

@property
def preferences(self) -> list[dict]:
return self._raw["preferences"]
def preferences(self) -> dict:
return self._raw.get("preferences", {})

@property
def clusters(self) -> list[dict]:
return self._raw["clusters"]
return self._raw.get("clusters", [])

@property
def users(self) -> list[dict]:
return self._raw["users"]
return self._raw.get("users", [])

@property
def contexts(self) -> list[dict]:
return self._raw["contexts"]
return self._raw.get("contexts", [])

@property
def extensions(self) -> list[dict]:
return self._raw["extensions"] if "extensions" in self._raw else []
return self._raw.get("extensions", [])
2 changes: 1 addition & 1 deletion kr8s/_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
from packaging.version import parse as parse_version

KUBERNETES_MINIMUM_SUPPORTED_VERSION = parse_version("1.28")
KUBERNETES_MAXIMUM_SUPPORTED_VERSION = parse_version("1.33")
KUBERNETES_MAXIMUM_SUPPORTED_VERSION = parse_version("1.34")
9 changes: 8 additions & 1 deletion kr8s/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ async def test_kubeconfig_from_dict(temp_kubeconfig, cls):
with open(temp_kubeconfig) as fh:
config = yaml.safe_load(fh)
kubeconfig = await cls(config)
assert kubeconfig.raw == config
assert kubeconfig.raw["clusters"] == config["clusters"]
assert kubeconfig.raw["users"] == config["users"]
assert kubeconfig.raw["contexts"] == config["contexts"]
# Preferences and extensions are optional
if "preferences" in config:
assert kubeconfig.raw["preferences"] == config["preferences"]
if "extensions" in config:
assert kubeconfig.raw["extensions"] == config["extensions"]


@pytest.mark.parametrize("cls", [KubeConfig, KubeConfigSet])
Expand Down
Loading