更新cluster-storage 相关

pull/276/head
gjmzj 2018-07-28 11:50:39 +08:00
parent 5976f61497
commit 4cf167869c
5 changed files with 19 additions and 25 deletions

1
.gitignore vendored
View File

@ -16,6 +16,7 @@ hosts
# k8s storage manifests
manifests/storage/*
!manifests/storage/test.yaml
!manifests/storage/alicloud-nas/alicloud-disk.yaml
# k8s backup directory
roles/cluster-backup/files/*

View File

@ -5,10 +5,11 @@ storage_aliyun_nas_enabled: "no"
# nfs server 参数
nfs_server: "192.168.1.8"
nfs_server_path: "/data/nfs"
nfs_storage_class: "nfs-dynamic-class-01"
nfs_storage_class: "class-nfs-01"
nfs_provisioner_name: "nfs-provisioner-01"
# aliyun_nas 参数
storage_server: 172.16.3.86
storage_path: /data/nfs
storage_class_name: nfs-dynamic-class
aliyun_nas_server: "172.16.3.86"
aliyun_nas_server_path: "/data/nas"
aliyun_nas_storage_class: "class-aliyun-nas-01"
aliyun_nas_controller_name: "aliyun-nas-controller-01"

View File

@ -1,30 +1,22 @@
- block:
- name: 准备nfs-client 配置目录
file: name={{ base_dir }}/manifests/storage/nfs/{{ nfs_provisioner_name }} state=directory
file: name={{ base_dir }}/manifests/storage/nfs state=directory
- name: 准备部署nfs-client动态存储
template:
src: nfs/nfs-client-provisioner.yaml.j2
dest: "{{ base_dir }}/manifests/storage/nfs/{{ nfs_provisioner_name }}/nfs-client-provisioner.yaml"
dest: "{{ base_dir }}/manifests/storage/nfs/{{ nfs_provisioner_name }}.yaml"
- name: 开始部署nfs-client动态存储
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/nfs/{{ nfs_provisioner_name }}"
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/nfs/{{ nfs_provisioner_name }}.yaml"
when: 'storage_nfs_enabled == "yes"'
- block:
- name: 准备部署alicloud-nas动态存储
template:
src: alicloud-nas/alicloud-nas.yaml.j2
dest: "{{ base_dir }}/manifests/storage/alicloud-nas/alicloud-nas.yaml"
dest: "{{ base_dir }}/manifests/storage/alicloud-nas/{{ aliyun_nas_controller_name }}.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"
shell: "{{ bin_dir }}/kubectl apply -f {{ base_dir }}/manifests/storage/alicloud-nas/{{ aliyun_nas_controller_name }}.yaml"
when: 'storage_aliyun_nas_enabled == "yes"'
- 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"
when: 'storage_aliyun_nas_enabled == "yes"'

View File

@ -1,7 +1,7 @@
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: alicloud-nas
name: {{ aliyun_nas_storage_class }}
provisioner: alicloud/nas
---
apiVersion: v1
@ -26,7 +26,7 @@ roleRef:
kind: Deployment
apiVersion: apps/v1beta1
metadata:
name: alicloud-nas-controller
name: {{ aliyun_nas_controller_name }}
namespace: kube-system
spec:
replicas: 1
@ -35,7 +35,7 @@ spec:
template:
metadata:
labels:
app: alicloud-nas-controller
app: {{ aliyun_nas_controller_name }}
spec:
serviceAccount: alicloud-nas-controller
containers:
@ -48,11 +48,11 @@ spec:
- name: PROVISIONER_NAME
value: alicloud/nas
- name: NFS_SERVER
value: {{ storage_server }}
value: {{ aliyun_nas_server }}
- name: NFS_PATH
value: {{ storage_path }}
value: {{ aliyun_nas_server_path }}
volumes:
- name: nfs-client-root
nfs:
server: {{ storage_server }}
path: {{ storage_path }}
server: {{ aliyun_nas_server }}
path: {{ aliyun_nas_server_path }}

View File

@ -20,7 +20,7 @@
copy:
src: "{{ base_dir }}/roles/{{ item }}/defaults/main.yml"
dest: "{{ base_dir }}/roles/{{ item }}/vars/main.yml"
force: "no"
force: "yes"
with_items:
- calico
- cluster-addon