From 4b4bdd35e8292352c2e937b6fa71aaf3cedbe6db Mon Sep 17 00:00:00 2001 From: smahana123 Date: Thu, 17 Nov 2022 15:20:59 +0530 Subject: [PATCH] Installation script for nfs server. Issue-Id: AIMLFW-4 Signed-off-by: smahana123 Change-Id: I2d9ac2f6df0636b99790e39ba213de586eb5d0dc --- tools/nfs/configure_nfs_server.sh | 27 ++++++++++++++++++++++ .../nfs/delete_nfs_subdir_external_provisioner.sh | 19 +++++++++++++++ .../nfs/install_nfs_subdir_external_provisioner.sh | 20 ++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100755 tools/nfs/configure_nfs_server.sh create mode 100755 tools/nfs/delete_nfs_subdir_external_provisioner.sh create mode 100755 tools/nfs/install_nfs_subdir_external_provisioner.sh diff --git a/tools/nfs/configure_nfs_server.sh b/tools/nfs/configure_nfs_server.sh new file mode 100755 index 0000000..9321154 --- /dev/null +++ b/tools/nfs/configure_nfs_server.sh @@ -0,0 +1,27 @@ +# ================================================================================== +# +# Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ================================================================================== + +sudo apt update +sudo apt install -y nfs-kernel-server +sudo mkdir /srv/nfs/kubedata -p +sudo chown nobody: /srv/nfs/kubedata/ +sudo sed "/kubedata/d" /etc/exports > /tmp/exports_tmp ; sudo mv /tmp/exports_tmp /etc/exports +echo "/srv/nfs/kubedata $1(rw,sync,no_subtree_check,no_root_squash,no_all_squash,insecure)" >> /etc/exports +sudo exportfs -a +sudo systemctl restart nfs-kernel-server +echo "Configuring NFS server complete" diff --git a/tools/nfs/delete_nfs_subdir_external_provisioner.sh b/tools/nfs/delete_nfs_subdir_external_provisioner.sh new file mode 100755 index 0000000..bb84398 --- /dev/null +++ b/tools/nfs/delete_nfs_subdir_external_provisioner.sh @@ -0,0 +1,19 @@ +# ================================================================================== +# +# Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ================================================================================== + +helm delete nfs-subdir-external-provisioner diff --git a/tools/nfs/install_nfs_subdir_external_provisioner.sh b/tools/nfs/install_nfs_subdir_external_provisioner.sh new file mode 100755 index 0000000..e46f2bb --- /dev/null +++ b/tools/nfs/install_nfs_subdir_external_provisioner.sh @@ -0,0 +1,20 @@ +# ================================================================================== +# +# Copyright (c) 2022 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# ================================================================================== + +helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/ +helm install nfs-subdir-external-provisioner nfs-subdir-external-provisioner/nfs-subdir-external-provisioner --set nfs.server=$1 --set nfs.path=/srv/nfs/kubedata --set storageClass.defaultClass=true -- 2.16.6