Skip to content

Commit 8f5726d

Browse files
committed
feat(argo-workflows): don't run as namespaced
Make the Argo Server, the UI and API component, and the Workflow Controller, the actual workflow engine, not run as namespaced so the UI and API can see and manage Argo Events. This is because Argo Events uses the same Argo Server for its UI and we run the EventSources and Sensors in a different namespace. Changed the Workflow Controller as well because it was easier and cleaner to do so and allowed us to use the upstream manifests more cleanly. To achieve the same protection and separation, switch to the ClusterRole and just use a RoleBinding to bind it to specific namespaces. This makes using the upstream manifests a little more cleaner and they already have separate roles for what we called the runtime so we can delete those.
1 parent 6308505 commit 8f5726d

10 files changed

+55
-130
lines changed

components/argo-events/argo-server-rb.yaml renamed to components/argo-events/argo-server-rolebinding.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ apiVersion: apps/v1
22
kind: RoleBinding
33
metadata:
44
name: argo-server-binding
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: ClusterRole
8+
name: argo-server-cluster-role
59
subjects:
610
- kind: ServiceAccount
711
name: argo-server

components/argo-events/kustomization.yaml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ resources:
88
- https://github.com/argoproj/argo-events/releases/download/v1.9.7/install-validating-webhook.yaml
99

1010
# grant the argo-workflows the ability to run workflows in this namespace
11-
- https://github.com/argoproj/argo-workflows/manifests/namespace-install/argo-server-rbac?ref=v3.5.10
12-
- https://github.com/argoproj/argo-workflows/manifests/namespace-install/workflow-controller-rbac?ref=v3.5.10
11+
- workflow-controller-rolebinding.yaml
12+
# grant the argo-server the ability to see workflows in this namespace
13+
- argo-server-rolebinding.yaml
1314

1415
## configure webhook Sensor and associated role
1516
- sensor-workflow-role.yaml
@@ -19,14 +20,3 @@ resources:
1920

2021
## copy openstack/cinder-netapp-config to argo-events/netapp-config
2122
- secret-netapp.yaml
22-
23-
patches:
24-
- target:
25-
kind: RoleBinding
26-
name: argo-binding
27-
path: controller-rb.yaml
28-
29-
- target:
30-
kind: RoleBinding
31-
name: argo-server-binding
32-
path: argo-server-rb.yaml

components/argo-events/controller-rb.yaml renamed to components/argo-events/workflow-controller-rolebinding.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ apiVersion: apps/v1
22
kind: RoleBinding
33
metadata:
44
name: argo-binding
5+
roleRef:
6+
apiGroup: rbac.authorization.k8s.io
7+
kind: ClusterRole
8+
name: argo-cluster-role
59
subjects:
610
- kind: ServiceAccount
711
name: argo

components/argo/argo-server-deployment.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,3 @@ spec:
1313
- --auth-mode=sso
1414
# all other auth via Kubernetes bearer tokens
1515
- --auth-mode=client
16-
# running in namespaced mode and not cluster wide
17-
- --namespaced
18-
# configures the namespace where workflows actually run
19-
- --managed-namespace
20-
- argo-events

components/argo/argo-server-runtime.yaml

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRoleBinding
4+
metadata:
5+
name: argo-server-binding
6+
$patch: delete
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
apiVersion: rbac.authorization.k8s.io/v1
3+
kind: ClusterRoleBinding
4+
metadata:
5+
name: argo-binding
6+
$patch: delete

components/argo/kustomization.yaml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1
33
kind: Kustomization
44

55
resources:
6-
# We are doing upstream's namespace-install.yaml but since we
7-
# want the actual workflows to run in a different namespace
8-
# the roles are created there
9-
- https://github.com/argoproj/argo-workflows/manifests/base?ref=v3.5.10
10-
# give the workflow controller access it needs
11-
- workflow-controller-runtime.yaml
12-
# give the argo-server access it needs
13-
- argo-server-runtime.yaml
6+
# We are wanting to limit the scope and access down to
7+
# just the namespaces we want to give access for workflows
8+
# to run and the argo-server to be able to see workflows and
9+
# argo events so we need to split up what we install. So
10+
# we delete the ClusterRoleBinding and instead create RoleBindings
11+
# to the ClusterRole for just the namespaces we want.
12+
- https://github.com/argoproj/argo-workflows/manifests/cluster-install/?ref=v3.5.10
1413

1514
# ingress for workflows.${DNS_ZONE} to the argo server for the UI
1615
- ingress.yaml
@@ -28,6 +27,20 @@ images:
2827
newTag: v3.5.10
2928

3029
patches:
30+
- target:
31+
group: rbac.authorization.k8s.io
32+
version: v1
33+
kind: ClusterRoleBinding
34+
name: argo-binding
35+
path: delete-workflow-controller-crb.yaml
36+
37+
- target:
38+
group: rbac.authorization.k8s.io
39+
version: v1
40+
kind: ClusterRoleBinding
41+
name: argo-server-binding
42+
path: delete-argo-server-crb.yaml
43+
3144
# see the patch for details on the change
3245
- target:
3346
group: apps

components/argo/workflow-controller-runtime.yaml

Lines changed: 0 additions & 58 deletions
This file was deleted.

docs/design-guide/argo-workflows.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,33 @@ and maintenance tasks.
1313
while the actual workflows run in another dedicated namespace (argo-events),
1414
to ensure proper security isolation and resource control. This separation
1515
is provided by [Argo Workflows][argo-wf] but poorly documented upstream which
16-
they call [Managed Namespace][argo-wf-managed-ns].
16+
they call [Managed Namespace][argo-wf-managed-ns]. Unfortunately the
17+
likely better approach at achieving this managed namespace installation
18+
would be to use the cluster based install which uses ClusterRoles but then
19+
binds the ClusterRole to a specific namespace instead of a ClusterRoleBinding.
20+
This is the approach we take.
1721

1822
### Argo Workflows Configuration
1923

2024
We do not use the `namespace-install.yaml` provided by the project as it
21-
combines everything into one YAML and we need to split it out. It combines:
25+
combines everything into one YAML and focuses on running everything in
26+
one namespace while we want separation. What we ultimately need:
2227

2328
* CRDs
2429
* Argo Server, which is the UI and the API for Argo Workflows and Argo Events
2530
* Argo Workflows Controller, which is the executor for the workflow and creates
2631
the pods
27-
* Server Role, which is the Role and RoleBinding for the Argo Server to access
32+
* Server RBAC, which is the ClusterRole and RoleBinding for the Argo Server to access
2833
the workflow, the pods, the logs, and inputs for user visibility
29-
* Workflow Controller Role, which is the Role and RoleBinding to give the controller
34+
* Workflow Controller RBAC, which is the ClusterRole and RoleBinding to give the controller
3035
access to run and manage the workflows.
3136

3237
The CRDs, the Argo Server, and the Argo Workflow Controller will all be installed
33-
into the (argo) namespace while the 2 Roles and RoleBindings need to be installed
38+
into the (argo) namespace while the 2 RoleBindings need to be installed
3439
into the namespace where the workflow execute, which is (argo-events).
3540

3641
The Argo Server and the Workflow Controller additionally need access to additional
37-
resources. The Argo Server needs access to the configmap, the SSO secret
42+
resources. The Argo Server needs access to the configmap, the SSO secret.
3843

3944
## Template-Only Execution Model
4045

0 commit comments

Comments
 (0)