Skip to content

Commit

Permalink
Merge pull request #1027 from nolar/upgrades
Browse files Browse the repository at this point in the history
Upgrade K8s/K3s to v1.27 and CI tooling (MyPy)
  • Loading branch information
nolar committed May 6, 2023
2 parents 0692ff0 + 6857a7a commit c266479
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
strategy:
fail-fast: false
matrix:
k3s: [latest, v1.25, v1.24, v1.23, v1.22]
k3s: [latest, v1.26, v1.25, v1.24, v1.23]
name: K3s ${{matrix.k3s}}
runs-on: ubuntu-22.04
timeout-minutes: 10 # usually 4-5 mins
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/thorough.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
strategy:
fail-fast: false
matrix:
k3s: [latest, v1.25, v1.24, v1.23, v1.22]
k3s: [latest, v1.26, v1.25, v1.24, v1.23]
name: K3s ${{matrix.k3s}}
runs-on: ubuntu-22.04
timeout-minutes: 10 # usually 4-5 mins
Expand All @@ -127,7 +127,7 @@ jobs:
strategy:
fail-fast: false
matrix:
k8s: [latest, v1.25.6, v1.24.9, v1.23.16, v1.22.17]
k8s: [latest, v1.26.4, v1.25.9, v1.24.13, v1.23.17]
name: K8s ${{matrix.k8s}}
runs-on: ubuntu-22.04
timeout-minutes: 10 # usually 4-5 mins
Expand Down
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ sphinx>=2.0.0
sphinx-autobuild
sphinx-autodoc-typehints
sphinx_rtd_theme>=0.5

# Added 2023-05-06. TODO: Remove when resolved: https://github.com/psf/requests/issues/6432
urllib3<2.0.0
3 changes: 2 additions & 1 deletion kopf/_cogs/clients/watching.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ async def infinite_watch(
if ex.code != HTTP_TOO_MANY_REQUESTS_CODE:
raise

retry_wait = ex.details.get("retryAfterSeconds") or DEFAULT_RETRY_DELAY_SECONDS
retry_after = ex.details.get("retryAfterSeconds") if ex.details else None
retry_wait = retry_after or DEFAULT_RETRY_DELAY_SECONDS
logger.warning(
f"Receiving `too many requests` error from server, will retry after "
f"{retry_wait} seconds. Error details: {ex}"
Expand Down
10 changes: 5 additions & 5 deletions kopf/_core/actions/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import copy
import enum
import logging
from typing import Any, MutableMapping, Optional, Tuple
from typing import Any, Dict, MutableMapping, Optional, Tuple

import pythonjsonlogger.jsonlogger

Expand Down Expand Up @@ -40,7 +40,7 @@ class ObjectTextFormatter(ObjectFormatter, logging.Formatter):
pass


class ObjectJsonFormatter(ObjectFormatter, pythonjsonlogger.jsonlogger.JsonFormatter): # type: ignore
class ObjectJsonFormatter(ObjectFormatter, pythonjsonlogger.jsonlogger.JsonFormatter):
def __init__(
self,
*args: Any,
Expand All @@ -53,14 +53,14 @@ def __init__(
reserved_attrs |= {'k8s_skip', 'k8s_ref', 'settings'}
kwargs.update(reserved_attrs=reserved_attrs)
kwargs.setdefault('timestamp', True)
super().__init__(*args, **kwargs)
super().__init__(*args, **kwargs) # type: ignore # for untyped JsonFormatter.__init__()
self._refkey: str = refkey or DEFAULT_JSON_REFKEY

def add_fields(
self,
log_record: MutableMapping[str, object],
log_record: Dict[str, object],
record: logging.LogRecord,
message_dict: MutableMapping[str, object],
message_dict: Dict[str, object],
) -> None:
super().add_fields(log_record, record, message_dict)

Expand Down
2 changes: 1 addition & 1 deletion kopf/_core/engines/daemons.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ async def _runner(
# If this daemon is never going to be called again, we can release the
# live_fresh_body to save some memory.
if handler.id in memory.forever_stopped:
# If any other running daemon is referencing this Kubernetes
# If any other running daemon is referencing this Kubernetes
# resource, we can't free it
can_free = True
this_daemon = daemons[handler.id]
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ lxml
# TODO: Once 3.7 is removed (Jun 2023), roll back to unittest.mock.
mock
# Mypy requires typed-ast, which is broken on PyPy 3.7 (could work in PyPy 3.8).
mypy==0.991; implementation_name == "cpython"
mypy==1.2.0; implementation_name == "cpython"
pre-commit
pyngrok
pytest>=6.0.0
Expand Down

0 comments on commit c266479

Please sign in to comment.