Skip to content

Commit

Permalink
Merge pull request #6 from damdo/example-add-rbac
Browse files Browse the repository at this point in the history
example: add RBAC
  • Loading branch information
kkosmrli authored May 15, 2021
2 parents 17b40b6 + ae537b9 commit e626c69
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 3 deletions.
7 changes: 4 additions & 3 deletions example/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Deployment
metadata:
name: election-example
spec:
replicas: 2
selector:
matchLabels:
app: election-example
Expand All @@ -11,6 +12,7 @@ spec:
labels:
app: election-example
spec:
serviceAccountName: election-example
containers:
- name: test-container
image: pstauffer/curl:v1.0.3
Expand All @@ -31,7 +33,7 @@ spec:
memory: "64Mi"
cpu: "100m"
- name: elector-sidecar
image: kkosmrli/leader-elector:test
image: kkosmrli/leader-elector:release-0.1.1
imagePullPolicy: Always
resources:
limits:
Expand All @@ -42,6 +44,5 @@ spec:
args:
- "--election=example-election"
- "--namespace=default"
- "--locktype=configmaps"
- "--port=4040"
replicas: 2

42 changes: 42 additions & 0 deletions example/rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: election-example
namespace: default
rules:
- apiGroups:
- "coordination.k8s.io"
resources:
- leases
verbs:
- get
- create
- update
- apiGroups:
- ""
resources:
- configmaps
- endpoints
verbs:
- get
- create
- update
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: election-example
namespace: default
subjects:
- kind: ServiceAccount
name: election-example
roleRef:
kind: Role
name: election-example
apiGroup: rbac.authorization.k8s.io
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: election-example
namespace: default

0 comments on commit e626c69

Please sign in to comment.