Merge pull request #2232 from hswong3i/local_volume_provisioner

Update and cleanup Local volume provisioner
This commit is contained in:
Antoine Legrand 2018-02-06 09:28:41 +01:00 committed by GitHub
commit 2b6781bc65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 74 additions and 70 deletions

View file

@ -166,7 +166,7 @@ istio_enabled: false
registry_enabled: false registry_enabled: false
# Local volume provisioner deployment # Local volume provisioner deployment
local_volumes_enabled: false local_volume_provisioner_enabled: false
# Add Persistent Volumes Storage Class for corresponding cloud provider ( OpenStack is only supported now ) # Add Persistent Volumes Storage Class for corresponding cloud provider ( OpenStack is only supported now )
persistent_volumes_enabled: false persistent_volumes_enabled: false

View file

@ -1,6 +1,6 @@
--- ---
local_volume_provisioner_bootstrap_image_repo: quay.io/external_storage/local-volume-provisioner-bootstrap local_volume_provisioner_bootstrap_image_repo: quay.io/external_storage/local-volume-provisioner-bootstrap
local_volume_provisioner_bootstrap_image_tag: v1.0.0 local_volume_provisioner_bootstrap_image_tag: v1.0.1
local_volume_provisioner_image_repo: quay.io/external_storage/local-volume-provisioner local_volume_provisioner_image_repo: quay.io/external_storage/local-volume-provisioner
local_volume_provisioner_image_tag: v1.0.0 local_volume_provisioner_image_tag: v1.0.1

View file

@ -20,23 +20,24 @@
- name: Local Volume Provisioner | Create manifests - name: Local Volume Provisioner | Create manifests
template: template:
src: "{{item.file}}.j2" src: "{{ item.file }}.j2"
dest: "{{kube_config_dir}}/addons/local_volume_provisioner/{{item.file}}" dest: "{{ kube_config_dir }}/addons/local_volume_provisioner/{{ item.file }}"
with_items: with_items:
- {name: local-storage-provisioner-pv-binding, file: provisioner-admin-account.yml, type: clusterrolebinding} - { name: local-volume-serviceaccount, file: serviceaccount.yml, type, serviceaccount }
- {name: local-volume-config, file: volume-config.yml, type: configmap} - { name: local-volume-clusterrolebinding, file: clusterrolebinding.yml, type, clusterrolebinding }
- {name: local-volume-provisioner, file: provisioner-ds.yml, type: daemonset} - { name: local-volume-configmap, file: configmap.yml, type, configmap }
- { name: local-volume-daemonset, file: daemonset.yml, type, daemonset }
register: local_volume_manifests register: local_volume_manifests
when: inventory_hostname == groups['kube-master'][0] when: inventory_hostname == groups['kube-master'][0]
- name: Local Volume Provisioner | Apply manifests - name: Local Volume Provisioner | Apply manifests
kube: kube:
name: "{{item.item.name}}" name: "{{ item.item.name }}"
namespace: "{{ system_namespace }}" namespace: "{{ system_namespace }}"
kubectl: "{{bin_dir}}/kubectl" kubectl: "{{ bin_dir }}/kubectl"
resource: "{{item.item.type}}" resource: "{{ item.item.type }}"
filename: "{{kube_config_dir}}/addons/local_volume_provisioner/{{item.item.file}}" filename: "{{ kube_config_dir }}/addons/local_volume_provisioner/{{ item.item.file }}"
state: "latest" state: "latest"
with_items: "{{ local_volume_manifests.results }}" with_items: "{{ local_volume_manifests.results }}"
when: inventory_hostname == groups['kube-master'][0] when: inventory_hostname == groups['kube-master'][0]

View file

@ -1,16 +1,11 @@
--- ---
apiVersion: v1
kind: ServiceAccount
metadata:
name: local-storage-admin
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: local-storage-provisioner-pv-binding name: local-storage-provisioner-pv-binding
namespace: {{ system_namespace }} namespace: {{ system_namespace }}
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: local-storage-admin name: local-storage-admin
namespace: {{ system_namespace }} namespace: {{ system_namespace }}
roleRef: roleRef:
@ -18,17 +13,16 @@ roleRef:
name: system:persistent-volume-provisioner name: system:persistent-volume-provisioner
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io
--- ---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata: metadata:
name: local-storage-provisioner-node-binding name: local-storage-provisioner-node-binding
namespace: {{ system_namespace }} namespace: {{ system_namespace }}
subjects: subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: local-storage-admin name: local-storage-admin
namespace: {{ system_namespace }} namespace: {{ system_namespace }}
roleRef: roleRef:
kind: ClusterRole kind: ClusterRole
name: system:node name: system:node
apiGroup: rbac.authorization.k8s.io apiGroup: rbac.authorization.k8s.io

View file

@ -1,7 +1,8 @@
---
# The config map is used to configure local volume discovery for Local SSDs on GCE and GKE. # The config map is used to configure local volume discovery for Local SSDs on GCE and GKE.
# It is a map from storage class to its mount configuration. # It is a map from storage class to its mount configuration.
apiVersion: v1
kind: ConfigMap kind: ConfigMap
apiVersion: v1
metadata: metadata:
name: local-volume-config name: local-volume-config
namespace: {{ system_namespace }} namespace: {{ system_namespace }}

View file

@ -0,0 +1,43 @@
---
kind: DaemonSet
apiVersion: extensions/v1beta1
metadata:
name: local-volume-provisioner
namespace: "{{ system_namespace }}"
spec:
template:
metadata:
labels:
app: local-volume-provisioner
spec:
containers:
- name: provisioner
image: {{ local_volume_provisioner_image_repo }}:{{ local_volume_provisioner_image_tag }}
imagePullPolicy: {{ k8s_image_pull_policy }}
securityContext:
privileged: true
volumeMounts:
- name: discovery-vol
mountPath: "/local-disks"
- name: local-volume-config
mountPath: /etc/provisioner/config/
env:
- name: MY_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: MY_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
volumes:
- name: discovery-vol
hostPath:
path: "{{ local_volume_base_dir }}"
- configMap:
defaultMode: 420
name: local-volume-config
name: local-volume-config
serviceAccount: local-storage-admin

View file

@ -1,42 +0,0 @@
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
name: local-volume-provisioner
namespace: "{{ system_namespace }}"
spec:
template:
metadata:
labels:
app: local-volume-provisioner
spec:
containers:
- name: provisioner
image: {{ local_volume_provisioner_image_repo }}:{{ local_volume_provisioner_image_tag }}
imagePullPolicy: {{ k8s_image_pull_policy }}
securityContext:
privileged: true
volumeMounts:
- name: discovery-vol
mountPath: "/local-disks"
- name: local-volume-config
mountPath: /etc/provisioner/config/
env:
- name: MY_NODE_NAME
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: spec.nodeName
- name: MY_NAMESPACE
valueFrom:
fieldRef:
apiVersion: v1
fieldPath: metadata.namespace
volumes:
- name: discovery-vol
hostPath:
path: "{{ local_volume_base_dir }}"
- configMap:
defaultMode: 420
name: local-volume-config
name: local-volume-config
serviceAccount: local-storage-admin

View file

@ -0,0 +1,5 @@
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: local-storage-admin

View file

@ -28,11 +28,12 @@ dependencies:
- registry - registry
- role: kubernetes-apps/local_volume_provisioner - role: kubernetes-apps/local_volume_provisioner
when: local_volumes_enabled when: local_volume_provisioner_enabled
tags: tags:
- apps - apps
- local_volume_provisioner - local_volume_provisioner
- storage - storage
# istio role should be last because it takes a long time to initialize and # istio role should be last because it takes a long time to initialize and
# will cause timeouts trying to start other addons. # will cause timeouts trying to start other addons.
- role: kubernetes-apps/istio - role: kubernetes-apps/istio
@ -40,6 +41,7 @@ dependencies:
tags: tags:
- apps - apps
- istio - istio
- role: kubernetes-apps/persistent_volumes - role: kubernetes-apps/persistent_volumes
when: persistent_volumes_enabled when: persistent_volumes_enabled
tags: tags: