Skip to content

Commit

Permalink
Remove route-agent OVN secrets RBAC
Browse files Browse the repository at this point in the history
This approach did not work properly on older versions of
Openshift plus kustomize automatically substitutes the
submariner-operator namespace in all resources (the OVN
RoleBinding needs to be in the openshift-ovn-kubernetes
namespace) so the kustomization layout would need more
work. So it was decided to remove the OVN namespace-specific
RBAC and add secrets permission to the route-agent ClusterRole
but restricted to just the "ovn-cert" resource.

Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
  • Loading branch information
tpantelis committed May 21, 2024
1 parent 856a4db commit 6666129
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 56 deletions.
9 changes: 9 additions & 0 deletions config/rbac/submariner-route-agent/cluster_role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ rules:
verbs:
- get
- list
- apiGroups:
- ""
resources:
- secrets
resourceNames:
# the route agent needs access to the ovn secret
- ovn-cert
verbs:
- get
- apiGroups:
- config.openshift.io
resources:
Expand Down
13 changes: 0 additions & 13 deletions config/rbac/submariner-route-agent/ovn_cluster_role.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions config/rbac/submariner-route-agent/ovn_role_binding.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions pkg/embeddedyamls/generators/yamls2go.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ var files = []string{
"config/rbac/submariner-route-agent/cluster_role_binding.yaml",
"config/rbac/submariner-route-agent/ocp_cluster_role.yaml",
"config/rbac/submariner-route-agent/ocp_cluster_role_binding.yaml",
"config/rbac/submariner-route-agent/ovn_cluster_role.yaml",
"config/rbac/submariner-route-agent/ovn_role_binding.yaml",
"config/rbac/submariner-globalnet/service_account.yaml",
"config/rbac/submariner-globalnet/role.yaml",
"config/rbac/submariner-globalnet/role_binding.yaml",
Expand Down
37 changes: 9 additions & 28 deletions pkg/embeddedyamls/yamls.go
Original file line number Diff line number Diff line change
Expand Up @@ -2924,6 +2924,15 @@ rules:
verbs:
- get
- list
- apiGroups:
- ""
resources:
- secrets
resourceNames:
# the route agent needs access to the ovn secret
- ovn-cert
verbs:
- get
- apiGroups:
- config.openshift.io
resources:
Expand Down Expand Up @@ -2991,34 +3000,6 @@ roleRef:
subjects:
- kind: ServiceAccount
name: submariner-routeagent
`
Config_rbac_submariner_route_agent_ovn_cluster_role_yaml = `---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: submariner-routeagent-ovn
rules:
- apiGroups: # the route agent needs access to ovn secrets
- ""
resources:
- secrets
verbs:
- get
- list
`
Config_rbac_submariner_route_agent_ovn_role_binding_yaml = `---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: submariner-routeagent-ovn
namespace: openshift-ovn-kubernetes
subjects:
- kind: ServiceAccount
name: submariner-routeagent
roleRef:
kind: ClusterRole
name: submariner-routeagent-ovn
apiGroup: rbac.authorization.k8s.io
`
Config_rbac_submariner_globalnet_service_account_yaml = `---
apiVersion: v1
Expand Down

0 comments on commit 6666129

Please sign in to comment.