添加cluster-storage roles

pull/267/head
lusyoe 2018-07-25 18:25:38 +08:00
parent 5a7d610a29
commit 4750465c81
9 changed files with 54 additions and 43 deletions

View File

@ -0,0 +1,5 @@
- hosts:
- deploy
- kube-node
roles:
- cluster-storage

View File

@ -26,8 +26,3 @@ heapster_offline: "heapster_v1.5.1.tar"
# prometheus 自动安装 # prometheus 自动安装
#prometheus_install: "no" #prometheus_install: "no"
# 动态存储自动安装
nfsclient_install: "no"
alicloudnas_install: "no"
storage_install: "no"

View File

@ -79,32 +79,3 @@
when: '"heapster" not in pod_info.stdout and heapster_install == "yes"' when: '"heapster" not in pod_info.stdout and heapster_install == "yes"'
ignore_errors: true ignore_errors: true
- block:
- name: 准备部署nfs-client动态存储
template:
src: storage/nfs/nfs-client-provisioner.yaml.j2
dest: "{{ base_dir }}/manifests/storage/nfs/nfs-client-provisioner.yaml"
- name: 开始部署nfs-client动态存储
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/nfs/nfs-client-provisioner.yaml"
when: 'nfsclient_install == "yes"'
- block:
- name: 准备部署alicloud-nas动态存储
template:
src: storage/alicloud-nas/alicloud-nas.yaml.j2
dest: "{{ base_dir }}/manifests/storage/alicloud-nas/alicloud-nas.yaml"
- name: 开始部署alicloud-disk存储
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/alicloud-nas/alicloud-disk.yaml"
- name: 开始部署alicloud-nas动态存储
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/alicloud-nas/alicloud-nas.yaml"
when: 'alicloudnas_install == "yes"'
- block:
- name: 准备部署动态存储类
template:
src: storage/dynamic-storageclass.yaml.j2
dest: "{{ base_dir }}/manifests/storage/dynamic-storageclass.yaml"
- name: 开始部署动态存储类
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/dynamic-storageclass.yaml"
when: 'storage_install == "yes"'

View File

@ -0,0 +1,8 @@
hosts: deploy
roles:
- cluster-storage
vars:
storage_type: nfs
storage_server: 172.16.3.86
storage_path: /data/nfs
storage_class_name: nfs-dynamic-class

View File

@ -0,0 +1,5 @@
# 动态存储类型, 目前支持nfs和alicloud-nas
storage_type: nfs
storage_server: 172.16.3.86
storage_path: /data/nfs
storage_class_name: nfs-dynamic-class

View File

@ -0,0 +1,27 @@
- block:
- name: 准备部署nfs-client动态存储
template:
src: nfs/nfs-client-provisioner.yaml.j2
dest: "{{ base_dir }}/manifests/storage/nfs/nfs-client-provisioner.yaml"
- name: 开始部署nfs-client动态存储
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/nfs/nfs-client-provisioner.yaml"
when: 'storage_type == "nfs"'
- block:
- name: 准备部署alicloud-nas动态存储
template:
src: alicloud-nas/alicloud-nas.yaml.j2
dest: "{{ base_dir }}/manifests/storage/alicloud-nas/alicloud-nas.yaml"
- name: 开始部署alicloud-disk存储
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/alicloud-nas/alicloud-disk.yaml"
- name: 开始部署alicloud-nas动态存储
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/alicloud-nas/alicloud-nas.yaml"
when: 'storage_type == "alicloud-nas"'
- block:
- name: 准备部署动态存储类
template:
src: dynamic-storageclass.yaml.j2
dest: "{{ base_dir }}/manifests/storage/dynamic-storageclass.yaml"
- name: 开始部署动态存储类
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/dynamic-storageclass.yaml"

View File

@ -48,11 +48,11 @@ spec:
- name: PROVISIONER_NAME - name: PROVISIONER_NAME
value: alicloud/nas value: alicloud/nas
- name: NFS_SERVER - name: NFS_SERVER
value: {{ STORAGE_SERVER }} value: {{ storage_server }}
- name: NFS_PATH - name: NFS_PATH
value: {{ STORAGE_PATH }} value: {{ storage_path }}
volumes: volumes:
- name: nfs-client-root - name: nfs-client-root
nfs: nfs:
server: {{ STORAGE_SERVER }} server: {{ storage_server }}
path: {{ STORAGE_PATH }} path: {{ storage_path }}

View File

@ -1,5 +1,5 @@
apiVersion: storage.k8s.io/v1 apiVersion: storage.k8s.io/v1
kind: StorageClass kind: StorageClass
metadata: metadata:
name: {{ STORAGE_CLASS_NAME }} name: {{ storage_class_name }}
provisioner: prov provisioner: prov

View File

@ -69,11 +69,11 @@ spec:
# 此处供应者名字供storageclass调用 # 此处供应者名字供storageclass调用
value: prov value: prov
- name: NFS_SERVER - name: NFS_SERVER
value: {{ STORAGE_SERVER }} value: {{ storage_server }}
- name: NFS_PATH - name: NFS_PATH
value: {{ STORAGE_PATH }} value: {{ storage_path }}
volumes: volumes:
- name: nfs-client-root - name: nfs-client-root
nfs: nfs:
server: {{ STORAGE_SERVER }} server: {{ storage_server }}
path: {{ STORAGE_PATH }} path: {{ storage_path }}