Skip to content

Commit

Permalink
chore: fix helm default RBAC
Browse files Browse the repository at this point in the history
  • Loading branch information
machine424 committed Sep 13, 2023
1 parent 8bddc0d commit 391b4bc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions helm-chart/kube-hpa-scale-to-zero/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ metadata:
subjects:
- kind: ServiceAccount
name: {{ include "kube-hpa-scale-to-zero.serviceAccountName" . }}
# namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
Expand Down
11 changes: 8 additions & 3 deletions tests/e2e_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

TESTS_PATH = Path(__file__).parent
MANIFESTS_PATH = TESTS_PATH / "manifests"
TEST_NS = "test-ns"

TIMEOUT = SYNC_INTERVAL * 3

Expand All @@ -26,6 +27,7 @@ def run(*, command: list[str], **kw_args) -> str:
@pytest.fixture(scope="session")
def setup():
try:
run(command=["kubectl", "create", "namespace", TEST_NS])
run(
command=[
"helm",
Expand Down Expand Up @@ -75,18 +77,19 @@ def setup():
]
)
run(command=["kubectl", "delete", "-f", f"{MANIFESTS_PATH}/metrics-generator.yaml"])
run(command=["kubectl", "delete", "namespace", TEST_NS])


def deploy_target(manifest: str):
run(command=["kubectl", "apply", "-f", f"{MANIFESTS_PATH}/{manifest}"])
run(command=["kubectl", "apply", "-f", f"{MANIFESTS_PATH}/{manifest}", "--namespace", TEST_NS])


def delete_target(manifest: str):
run(command=["kubectl", "delete", "-f", f"{MANIFESTS_PATH}/{manifest}"])
run(command=["kubectl", "delete", "-f", f"{MANIFESTS_PATH}/{manifest}", "--namespace", TEST_NS])


def run_scaler():
return subprocess.Popen(["python", f"{TESTS_PATH.parent}/main.py"])
return subprocess.Popen(["python", f"{TESTS_PATH.parent}/main.py", "--hpa-namespace", TEST_NS])


def set_foo_metric_value(value: int):
Expand All @@ -111,6 +114,8 @@ def wait_deployment_scale(*, name: str, replicas: int):
f"--for=jsonpath={{.spec.replicas}}={replicas}",
"deployment",
name,
"--namespace",
TEST_NS,
f"--timeout={TIMEOUT}s",
]
)
Expand Down

0 comments on commit 391b4bc

Please sign in to comment.