summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-08-07 18:47:39 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-08-07 18:47:39 +0200
commit79b191d207d7670295781c550847ce7d695cc388 (patch)
tree2b6fb60e40ab98b68d1bce6f8e96a528e99df265
parent9481fe4541a4f0abab6a4e76931a3d6bd9a5b8b0 (diff)
downloadands-79b191d207d7670295781c550847ce7d695cc388.tar.gz
ands-79b191d207d7670295781c550847ce7d695cc388.tar.bz2
ands-79b191d207d7670295781c550847ce7d695cc388.tar.xz
ands-79b191d207d7670295781c550847ce7d695cc388.zip
Support for Samba/CIFS storage and a sample how to mount LSDF shares
-rw-r--r--.gitmodules3
m---------anslib/openshift-flexvolume-cifs0
-rw-r--r--docs/samples/remote_storage/lsdf/lsdf-test.yml44
-rw-r--r--docs/samples/remote_storage/lsdf/lsdf.yml38
-rw-r--r--opts.sh1
-rw-r--r--playbooks/openshift-install-cifs.yml40
-rwxr-xr-xsetup.sh3
7 files changed, 129 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
index ea94509..877a36b 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,3 +7,6 @@
[submodule "anslib/ansible-role-ntp"]
path = anslib/ansible-role-ntp
url = http://darksoft.org/git/csa/devops/ansible-patches/ntp.git
+[submodule "anslib/openshift-flexvolume-cifs"]
+ path = anslib/openshift-flexvolume-cifs
+ url = https://github.com/sabre1041/openshift-flexvolume-cifs.git
diff --git a/anslib/openshift-flexvolume-cifs b/anslib/openshift-flexvolume-cifs
new file mode 160000
+Subproject 62bd24be902bee56f818c5e5d96602756390b88
diff --git a/docs/samples/remote_storage/lsdf/lsdf-test.yml b/docs/samples/remote_storage/lsdf/lsdf-test.yml
new file mode 100644
index 0000000..c02a888
--- /dev/null
+++ b/docs/samples/remote_storage/lsdf/lsdf-test.yml
@@ -0,0 +1,44 @@
+apiVersion: template.openshift.io/v1
+kind: Template
+metadata:
+ annotations:
+ name: lsdf-test
+objects:
+ - apiVersion: v1
+ kind: PersistentVolumeClaim
+ metadata:
+ name: lsdf-ips
+ spec:
+ volumeName: lsdf-ips
+ accessModes:
+ - ReadWriteOnce
+ resources:
+ requests:
+ storage: "10Ti"
+ - apiVersion: v1
+ kind: DeploymentConfig
+ metadata:
+ name: lsdf-test
+ spec:
+ replicas: 1
+ selector:
+ name: lsdf-test
+ strategy:
+ type: Recreate
+ template:
+ metadata:
+ labels:
+ name: lsdf-test
+ name: lsdf-test
+ spec:
+ volumes:
+ - name: lsdf-ips
+ persistentVolumeClaim:
+ claimName: lsdf-ips
+ containers:
+ - image: registry.access.redhat.com/rhel7/rhel:7.6
+ name: cifs-app
+ command: ["/bin/bash", "-c", "while true; do sleep 10; done"]
+ volumeMounts:
+ - name: lsdf-ips
+ mountPath: /mnt/lsdf
diff --git a/docs/samples/remote_storage/lsdf/lsdf.yml b/docs/samples/remote_storage/lsdf/lsdf.yml
new file mode 100644
index 0000000..c091870
--- /dev/null
+++ b/docs/samples/remote_storage/lsdf/lsdf.yml
@@ -0,0 +1,38 @@
+apiVersion: v1
+kind: Template
+metadata:
+ name: lsdf
+ annotations:
+ descriptions: "LSDF volumes"
+objects:
+ - apiVersion: v1
+ kind: Secret
+ metadata:
+ name: lsdf-csa
+ type: openshift.io/cifs
+ stringData:
+ username: "gf6501"
+ password: "<put_the_password_here>"
+ - apiVersion: v1
+ kind: PersistentVolume
+ metadata:
+ name: lsdf-ips
+ spec:
+ persistentVolumeReclaimPolicy: Retain
+ accessModes:
+ - ReadWriteMany
+ capacity:
+ storage: 100Ti
+ claimRef:
+ name: lsdf-ips
+ namespace: test
+ flexVolume:
+ driver: openshift.io/cifs
+ fsType: cifs
+ secretRef:
+ name: lsdf-csa
+ options:
+ networkPath: "//os.lsdf.kit.edu/ips-projects"
+ mountOptions: "vers=2.0,domain=os.lsdf.kit.edu,file_mode=0664,dir_mode=0775"
+
+ \ No newline at end of file
diff --git a/opts.sh b/opts.sh
index d87b89d..490082b 100644
--- a/opts.sh
+++ b/opts.sh
@@ -25,6 +25,7 @@ Actions:
projects - installs configuration files and OpenShift resources for KaaS and other configured projects
Additional services
+ cifs - install plugin for mounting Samba/CIFS volumes in pods
ganesha - provide external nfs access to gluster volumes
Maintenance
diff --git a/playbooks/openshift-install-cifs.yml b/playbooks/openshift-install-cifs.yml
new file mode 100644
index 0000000..92ed09c
--- /dev/null
+++ b/playbooks/openshift-install-cifs.yml
@@ -0,0 +1,40 @@
+---
+
+- hosts: nodes
+ serial: 1
+ vars:
+ vendor_name: openshift.io
+ driver_name: cifs
+ driver_location: "{{ playbook_dir }}/../anslib/openshift-flexvolume-cifs/flexvolume-driver/cifs"
+ volume_plugin_path: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec"
+ openshift_node_service: origin-node
+ install_packages:
+ - cifs-utils
+ tasks:
+ - name: Install required packages
+ package:
+ name: "{{ install_packages }}"
+ state: present
+ - name: Validate driver exists
+ stat:
+ path: "{{ driver_location }}"
+ register: driver_exists
+ delegate_to: localhost
+ - name: Fail if driver not found
+ fail:
+ msg: Driver file not found!
+ when: not driver_exists.stat.exists
+ - name: Create cifs driver directory
+ file:
+ state: directory
+ path: "{{ volume_plugin_path }}/{{ vendor_name }}~{{ driver_name }}"
+ - name: Copy cifs driver
+ copy:
+ src: "{{ driver_location }}"
+ dest: "{{ volume_plugin_path }}/{{ vendor_name }}~{{ driver_name }}/{{ driver_name }}"
+ mode: 0755
+ register: driver_copy
+ - name: Restart OpenShift Node Service
+ service:
+ name: "{{ openshift_node_service }}"
+ state: restarted \ No newline at end of file
diff --git a/setup.sh b/setup.sh
index f4271f8..8b8a6ec 100755
--- a/setup.sh
+++ b/setup.sh
@@ -40,6 +40,9 @@ case "$action" in
apply playbooks/ands-gluster-migrate.yml --extra-vars "gfs_from=$from gfs_to=$to" "$@" || exit 1
# echo "Currently unsupported, use scripts..."
;;
+ cifs)
+ apply playbooks/openshift-install-cifs.yml "$@" || exit 1
+ ;;
ganesha)
apply playbooks/ands-gluster-ganesha.yml "$@" || exit 1
;;