jedcunningham commented on code in PR #37197:
URL: https://github.com/apache/airflow/pull/37197#discussion_r1508171095
##########
helm_tests/airflow_aux/test_pod_launcher_role.py:
##########
@@ -49,3 +49,69 @@ def test_pod_launcher_role(self, executor, rbac, allow,
expected_accounts):
assert f"release-name-airflow-{suffix}" ==
jmespath.search(f"subjects[{idx}].name", docs[0])
else:
assert [] == docs
+
+ @pytest.mark.parametrize(
+ "multiNamespaceMode, namespace, expectedRole, expectedRoleBinding",
+ [
+ (
+ True,
+ "namespace",
+ "release-name-namespace-pod-launcher-role",
+ "release-name-namespace-pod-launcher-rolebinding",
+ ),
+ (
+ True,
+ "other-ns",
+ "release-name-other-ns-pod-launcher-role",
+ "release-name-other-ns-pod-launcher-rolebinding",
+ ),
+ (False, "namespace", "release-name-pod-launcher-role",
"release-name-pod-launcher-rolebinding"),
+ ],
+ )
+ def test_pod_launcher_rolebinding_multi_namespace(
+ self, multiNamespaceMode, namespace, expectedRole, expectedRoleBinding
+ ):
+ docs = render_chart(
+ namespace=namespace,
+ values={"webserver": {"allowPodLogReading": True},
"multiNamespaceMode": multiNamespaceMode},
+ show_only=["templates/rbac/pod-launcher-rolebinding.yaml"],
+ )
+
+ actualRoleBinding = jmespath.search("metadata.name", docs[0]) if docs
else []
Review Comment:
```suggestion
actualRoleBinding = jmespath.search("metadata.name", docs[0])
```
Why an empty list? I don't think we need to really check docs first though.
My 2c.
##########
chart/templates/rbac/pod-launcher-role.yaml:
##########
@@ -28,15 +28,20 @@ kind: ClusterRole
kind: Role
{{- end }}
metadata:
- name: {{ include "airflow.fullname" . }}-pod-launcher-role
{{- if not .Values.multiNamespaceMode }}
+ name: {{ include "airflow.fullname" . }}-pod-launcher-role
namespace: "{{ .Release.Namespace }}"
+ {{- else }}
+ name: {{ include "airflow.fullname" . }}-{{ .Release.Namespace
}}-pod-launcher-role
Review Comment:
Anyone have thoughts on namespace first?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]