upd: more common manifests

This commit is contained in:
Andrei Kvapil
2020-12-23 19:04:27 +01:00
parent 23bb95cef3
commit d138216421
2 changed files with 8 additions and 13 deletions

View File

@@ -9,13 +9,12 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: snapshot-controller name: snapshot-controller
namespace: default # TODO: replace with the namespace you want for your controller, e.g. kube-system namespace: kube-system
--- ---
kind: ClusterRole kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
# rename if there are conflicts
name: snapshot-controller-runner name: snapshot-controller-runner
rules: rules:
- apiGroups: [""] - apiGroups: [""]
@@ -51,10 +50,9 @@ metadata:
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: snapshot-controller name: snapshot-controller
namespace: default # TODO: replace with the namespace you want for your controller, e.g. kube-system namespace: kube-system
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
# change the name also here if the ClusterRole gets renamed
name: snapshot-controller-runner name: snapshot-controller-runner
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
@@ -62,8 +60,8 @@ roleRef:
kind: Role kind: Role
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
namespace: default # TODO: replace with the namespace you want for your controller, e.g. kube-system
name: snapshot-controller-leaderelection name: snapshot-controller-leaderelection
namespace: kube-system
rules: rules:
- apiGroups: ["coordination.k8s.io"] - apiGroups: ["coordination.k8s.io"]
resources: ["leases"] resources: ["leases"]
@@ -74,13 +72,11 @@ kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: snapshot-controller-leaderelection name: snapshot-controller-leaderelection
namespace: default # TODO: replace with the namespace you want for your controller, e.g. kube-system namespace: kube-system
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: snapshot-controller name: snapshot-controller
namespace: default # TODO: replace with the namespace you want for your controller, e.g. kube-system
roleRef: roleRef:
kind: Role kind: Role
name: snapshot-controller-leaderelection name: snapshot-controller-leaderelection
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io

View File

@@ -6,14 +6,13 @@
# Vanilla Kubernetes, kube-system makes sense for the namespace. # Vanilla Kubernetes, kube-system makes sense for the namespace.
--- ---
kind: StatefulSet kind: Deployment
apiVersion: apps/v1 apiVersion: apps/v1
metadata: metadata:
name: snapshot-controller name: snapshot-controller
namespace: default # TODO: replace with the namespace you want for your controller, e.g. kube-system namespace: kube-system
spec: spec:
serviceName: "snapshot-controller" replicas: 2
replicas: 1
selector: selector:
matchLabels: matchLabels:
app: snapshot-controller app: snapshot-controller
@@ -28,5 +27,5 @@ spec:
image: k8s.gcr.io/sig-storage/snapshot-controller:v4.0.0 image: k8s.gcr.io/sig-storage/snapshot-controller:v4.0.0
args: args:
- "--v=5" - "--v=5"
- "--leader-election=false" - "--leader-election=true"
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent