Add longhorn
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Adrien Reslinger 2020-08-08 00:06:28 +02:00
parent 59de075a0a
commit 8ddacfec51
28 changed files with 610 additions and 21 deletions

View file

@ -1,4 +1,7 @@
---
- name: Include file list
include_vars: "local.yaml"
- name: Defined local-path-storage state to present
set_fact:
storage_localpath_state: present
@ -16,12 +19,6 @@
state: "{{ storage_localpath_state }}"
context: "{{ my_context }}"
merge_type: merge
resource_definition: "{{ lookup('file', item) | from_yaml }}"
resource_definition: "{{ lookup('file', 'local/' + item) | from_yaml }}"
with_items:
- "local/local-path-storage-Namespace.yaml"
- "local/local-path-provisioner-service-account-ServiceAccount.yaml"
- "local/local-path-provisioner-role-ClusterRole.yaml"
- "local/local-path-provisioner-bind-ClusterRoleBinding.yaml"
- "local/local-path-provisioner-Deployment.yaml"
- "local/local-path-StorageClass.yaml"
- "local/local-path-config-ConfigMap.yaml"
- "{{ storage_localpath_files_list }}"

35
tasks/longhorn.yml Normal file
View file

@ -0,0 +1,35 @@
---
- name: Include file list
include_vars: "longhorn.yaml"
- name: Defined longhorn state to present
set_fact:
storage_longhorn_state: present
when:
- storage_longhorn|bool
- name: Define state of longhorn to absent
set_fact:
storage_longhorn_state: absent
when:
- not storage_longhorn|bool
- name: longhorn need to be {{ storage_longhorn_state }}
k8s:
state: "{{ storage_longhorn_state }}"
context: "{{ my_context }}"
merge_type: merge
namespace: longhorn-system
resource_definition: "{{ lookup('file', 'longhorn/' + item) | from_yaml }}"
with_items:
- "{{ storage_longhorn_files_list }}"
- name: Ingress for longhorn UI need to be {{ storage_longhorn_state }}
k8s:
state: "{{ storage_longhorn_state }}"
context: "{{ my_context }}"
merge_type: merge
namespace: longhorn-system
resource_definition: "{{ lookup('template', 'longhorn/' + item) | from_yaml }}"
with_items:
- "longhorn_ingressroute.yaml.j2"

View file

@ -2,6 +2,7 @@
block:
# - include_tasks: "manual.yml"
- include_tasks: "local.yml"
- include_tasks: "longhorn.yml"
- include_tasks: "nfs.yml"
- include_tasks: "digital_ocean.yml"
- include_tasks: "linode.yml"

View file

@ -2,6 +2,9 @@
# https://github.com/kubernetes-incubator/external-storage/blob/master/nfs/docs/deployment.md
# Ne pas oublier de "sudo chcon -Rt svirt_sandbox_file_t /srv" pour le stockage
# ou alors tourner le container en privileged
- name: Include file list
include_vars: "nfs.yaml"
- name: Defined nfs-provisioner state to present
set_fact:
storage_nfs_state: present
@ -19,14 +22,6 @@
state: "{{ storage_nfs_state }}"
context: "{{ my_context }}"
merge_type: merge
resource_definition: "{{ lookup('file', item) | from_yaml }}"
resource_definition: "{{ lookup('file', 'nfs/' + item) | from_yaml }}"
with_items:
- "nfs/nfs-provisioner-PodSecurityPolicy.yaml"
- "nfs/nfs-provisioner-runner-ClusterRole.yaml"
- "nfs/run-nfs-provisioner-ClusterRoleBinding.yaml"
- "nfs/leader-locking-nfs-provisioner-Role.yaml"
- "nfs/leader-locking-nfs-provisioner-RoleBinding.yaml"
- "nfs/nfs-provisioner-ServiceAccount.yaml"
- "nfs/nfs-provisioner-Service.yaml"
- "nfs/nfs-provisioner-Deployment.yaml"
- "nfs/example-nfs-StorageClass.yaml"
- "{{ store_nfs_files }}"