Skip to content

Commit

Permalink
Use the project-specific service account for the operator
Browse files Browse the repository at this point in the history
Previously the project is using the `default` service account to deploy and run the operator, which is not safe. This PR follows the [introduction](operator-framework/operator-sdk#4468) to run the operator with a project-specific service account (xxx-operator-controller-manager) to fix this issue.
  • Loading branch information
fantapsody committed Aug 20, 2021
1 parent 7f9f22d commit 00f7a8b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 4 deletions.
3 changes: 2 additions & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
containers:
- name: flink-operator
image: flink-operator:latest
command:
command:
- /flink-operator
args:
- --enable-leader-election
Expand All @@ -53,4 +53,5 @@ spec:
requests:
cpu: 100m
memory: 20Mi
serviceAccountName: controller-manager
terminationGracePeriodSeconds: 10
2 changes: 1 addition & 1 deletion config/rbac/auth_proxy_role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ roleRef:
name: proxy-role
subjects:
- kind: ServiceAccount
name: default
name: controller-manager
namespace: system
1 change: 1 addition & 0 deletions config/rbac/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ resources:
- auth_proxy_service.yaml
- auth_proxy_role.yaml
- auth_proxy_role_binding.yaml
- service_account.yaml
2 changes: 1 addition & 1 deletion config/rbac/leader_election_role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ roleRef:
name: leader-election-role
subjects:
- kind: ServiceAccount
name: default
name: controller-manager
namespace: system
2 changes: 1 addition & 1 deletion config/rbac/role_binding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ roleRef:
name: manager-role
subjects:
- kind: ServiceAccount
name: default
name: controller-manager
namespace: system
5 changes: 5 additions & 0 deletions config/rbac/service_account.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: controller-manager
namespace: system

0 comments on commit 00f7a8b

Please sign in to comment.