Skip to content

fix(k8s): change installer_tags to repeated string with unique validation #1058

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

Open
wants to merge 7 commits into
base: main
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
24 changes: 24 additions & 0 deletions scaleway-async/scaleway_async/k8s/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,14 @@ def unmarshal_NodeMetadata(data: Any) -> NodeMetadata:
else None
)

field = data.get("provider_id", None)
if field is not None:
args["provider_id"] = field

field = data.get("resolvconf_path", None)
if field is not None:
args["resolvconf_path"] = field

field = data.get("has_gpu", None)
if field is not None:
args["has_gpu"] = field
Expand All @@ -1054,6 +1062,22 @@ def unmarshal_NodeMetadata(data: Any) -> NodeMetadata:
if field is not None:
args["repo_uri"] = field

field = data.get("installer_tags", None)
if field is not None:
args["installer_tags"] = field

field = data.get("updater_bin_url", None)
if field is not None:
args["updater_bin_url"] = field

field = data.get("updater_bin_version", None)
if field is not None:
args["updater_bin_version"] = field

field = data.get("updater_bin_path", None)
if field is not None:
args["updater_bin_path"] = field

return NodeMetadata(**args)


Expand Down
12 changes: 12 additions & 0 deletions scaleway-async/scaleway_async/k8s/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1876,12 +1876,24 @@ class NodeMetadata:

node_taints: List[NodeMetadataCoreV1Taint]

provider_id: str

resolvconf_path: str

has_gpu: bool

external_ip: str

repo_uri: str

installer_tags: List[str]

updater_bin_url: str

updater_bin_version: str

updater_bin_path: str


@dataclass
class RebootNodeRequest:
Expand Down
7 changes: 7 additions & 0 deletions scaleway-core/scaleway_core/utils/resolve_one_of.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ def resolve_one_of(
# Get the first non-empty default
for possibility in possibilities:
if possibility.default is not None:
if possibility.marshal_func is not None:
# When no actual value, call with None as value
return {
possibility.param: possibility.marshal_func(
None, possibility.default
)
}
return {possibility.param: possibility.default}

# If required, raise an error
Expand Down
24 changes: 24 additions & 0 deletions scaleway/scaleway/k8s/v1/marshalling.py
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,14 @@ def unmarshal_NodeMetadata(data: Any) -> NodeMetadata:
else None
)

field = data.get("provider_id", None)
if field is not None:
args["provider_id"] = field

field = data.get("resolvconf_path", None)
if field is not None:
args["resolvconf_path"] = field

field = data.get("has_gpu", None)
if field is not None:
args["has_gpu"] = field
Expand All @@ -1054,6 +1062,22 @@ def unmarshal_NodeMetadata(data: Any) -> NodeMetadata:
if field is not None:
args["repo_uri"] = field

field = data.get("installer_tags", None)
if field is not None:
args["installer_tags"] = field

field = data.get("updater_bin_url", None)
if field is not None:
args["updater_bin_url"] = field

field = data.get("updater_bin_version", None)
if field is not None:
args["updater_bin_version"] = field

field = data.get("updater_bin_path", None)
if field is not None:
args["updater_bin_path"] = field

return NodeMetadata(**args)


Expand Down
11 changes: 11 additions & 0 deletions scaleway/scaleway/k8s/v1/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1876,12 +1876,23 @@ class NodeMetadata:

node_taints: List[NodeMetadataCoreV1Taint]

provider_id: str

resolvconf_path: str

has_gpu: bool

external_ip: str

repo_uri: str

installer_tags: List[str]

updater_bin_url: str

updater_bin_version: str

updater_bin_path: str

@dataclass
class RebootNodeRequest:
Expand Down
Loading