parameterized snaphot controller namespaces (#8305)

* Parameterized snaphot controller namespaces

* add ns yml

* add docs

* namespace
This commit is contained in:
Samuel Liu 2022-01-15 04:58:26 +08:00 committed by GitHub
parent ccd3180a69
commit 1a69f8c3ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 6 deletions

View file

@ -57,6 +57,8 @@ local_volume_provisioner_enabled: false
# currently, setting cinder_csi_enabled=true would automatically enable the snapshot controller # currently, setting cinder_csi_enabled=true would automatically enable the snapshot controller
# Longhorn is an extenal CSI that would also require setting this to true but it is not included in kubespray # Longhorn is an extenal CSI that would also require setting this to true but it is not included in kubespray
# csi_snapshot_controller_enabled: false # csi_snapshot_controller_enabled: false
# csi snapshot namespace
# snapshot_controller_namespace: kube-system
# CephFS provisioner deployment # CephFS provisioner deployment
cephfs_provisioner_enabled: false cephfs_provisioner_enabled: false

View file

@ -1,2 +1,3 @@
--- ---
snapshot_controller_replicas: 1 snapshot_controller_replicas: 1
snapshot_controller_namespace: kube-system

View file

@ -5,6 +5,7 @@
dest: "{{ kube_config_dir }}/{{ item.file }}" dest: "{{ kube_config_dir }}/{{ item.file }}"
mode: 0644 mode: 0644
with_items: with_items:
- {name: snapshot-ns, file: snapshot-ns.yml}
- {name: rbac-snapshot-controller, file: rbac-snapshot-controller.yml} - {name: rbac-snapshot-controller, file: rbac-snapshot-controller.yml}
- {name: snapshot-controller, file: snapshot-controller.yml} - {name: snapshot-controller, file: snapshot-controller.yml}
register: snapshot_controller_manifests register: snapshot_controller_manifests

View file

@ -9,7 +9,7 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
name: snapshot-controller name: snapshot-controller
namespace: kube-system namespace: {{ snapshot_controller_namespace }}
--- ---
kind: ClusterRole kind: ClusterRole
@ -51,7 +51,7 @@ metadata:
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: snapshot-controller name: snapshot-controller
namespace: kube-system namespace: {{ snapshot_controller_namespace }}
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
# change the name also here if the ClusterRole gets renamed # change the name also here if the ClusterRole gets renamed
@ -62,7 +62,7 @@ roleRef:
kind: Role kind: Role
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
namespace: kube-system namespace: {{ snapshot_controller_namespace }}
name: snapshot-controller-leaderelection name: snapshot-controller-leaderelection
rules: rules:
- apiGroups: ["coordination.k8s.io"] - apiGroups: ["coordination.k8s.io"]
@ -74,11 +74,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: kube-system namespace: {{ snapshot_controller_namespace }}
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: snapshot-controller name: snapshot-controller
namespace: kube-system namespace: {{ snapshot_controller_namespace }}
roleRef: roleRef:
kind: Role kind: Role
name: snapshot-controller-leaderelection name: snapshot-controller-leaderelection

View file

@ -10,7 +10,7 @@ kind: Deployment
apiVersion: apps/v1 apiVersion: apps/v1
metadata: metadata:
name: snapshot-controller name: snapshot-controller
namespace: kube-system namespace: {{ snapshot_controller_namespace }}
spec: spec:
replicas: {{ snapshot_controller_replicas }} replicas: {{ snapshot_controller_replicas }}
selector: selector:

View file

@ -0,0 +1,7 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ snapshot_controller_namespace }}
labels:
name: {{ snapshot_controller_namespace }}