Skip to content

Commit 7124e93

Browse files
authored
QA install script additions (#2762)
1 parent 3c5b706 commit 7124e93

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

scripts/qa/boilerplate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ class AppsConfig:
2929

3030
path: Path
3131

32-
def set(self, key: str, value: Jsonable) -> None:
32+
def set(self, key: str, value: Jsonable, merge: bool = True) -> None:
3333
"""Set a config key (with merge)"""
3434
_run(
3535
"yq",
3636
"-i",
37-
f".{key} = .{key} * {json.dumps(value)}",
37+
f".{key} = .{key} * {json.dumps(value)}" if merge else f".{key} = {json.dumps(value)}",
3838
self.path.resolve().as_posix(),
3939
)
4040

scripts/qa/config.json.sample

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@
5252
"apiServer": [],
5353
"nodes": [],
5454
"ingress": []
55-
}
55+
},
56+
"networkPlugin": "set-me"
5657
}

scripts/qa/config.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,18 @@
88
import json
99
import sys
1010
from contextlib import suppress
11-
from typing import Any, Optional, Type, TypedDict, Union, cast, get_args, get_origin, get_type_hints
11+
from typing import (
12+
Any,
13+
Literal,
14+
Optional,
15+
Type,
16+
TypedDict,
17+
Union,
18+
cast,
19+
get_args,
20+
get_origin,
21+
get_type_hints,
22+
)
1223

1324
AwsSecrets = TypedDict(
1425
"AwsSecrets",
@@ -60,6 +71,8 @@
6071
total=False,
6172
)
6273

74+
NetworkPlugin = Literal["calico", "cilium"]
75+
6376

6477
class Config(TypedDict):
6578
"""Holds the parsed configuration"""
@@ -75,6 +88,8 @@ class Config(TypedDict):
7588
wcSubnets: Optional[Subnets]
7689
scSubnets: Optional[Subnets]
7790

91+
networkPlugin: Optional[NetworkPlugin]
92+
7893

7994
def dig(config: Config, path: str) -> str | int | float | bool | list | dict | None:
8095
"""Dig a dotted expression out of the config"""
@@ -140,6 +155,9 @@ def get_default_value(f_type: Type) -> Any:
140155
return set()
141156
if origin is tuple:
142157
return ()
158+
if origin is Literal:
159+
non_none_types = get_non_none_types(f_type)
160+
return get_default_value(type(non_none_types[0])) if non_none_types else None
143161

144162
# Default fallback
145163
return None

scripts/qa/install_apps.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ def configure_apps(
4848
) -> None:
4949
"""Configure apps"""
5050

51+
# Configure network plugin
52+
if (network_plugin := args.config["networkPlugin"]) is not None:
53+
common_config.set("networkPlugin.type", network_plugin, merge=False)
54+
5155
# Configure platform administrators
5256
common_config.set("clusterAdmin", {"users": [], "groups": [args.config["adminGroup"]]})
5357

@@ -127,7 +131,7 @@ def configure_apps(
127131
)
128132

129133
# Configure Falco BPF driver
130-
common_config.set("falco.driver", {"kind": "modern-bpf"})
134+
common_config.set("falco.driver", {"kind": "modern_ebpf"})
131135

132136
# Configure Grafana with test requirements
133137
grafana_cfg = {

0 commit comments

Comments
 (0)