From 754d15c252bb367af889553143a0e31efedc3e6f Mon Sep 17 00:00:00 2001 From: Esther Kim Date: Mon, 22 Mar 2021 11:35:08 +0900 Subject: [PATCH] added new script to create site --- README.md | 15 +++++++++++++++ create_site.sh | 23 +++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 create_site.sh diff --git a/README.md b/README.md index 227b30e..92e4550 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,21 @@ This repository contains custom configurations for [decapod-base-yaml](https://g * [Make your own site-yaml](https://github.com/openinfradev/decapod-base-yaml/blob/main/docs/quickstart.md#make-your-own-site-yaml) * [CI pipeline](docs/ci.md) + +## Make your own site +```console +$ ./create_site.sh site_name +Cloning into '.base-yaml'... +remote: Enumerating objects: 146, done. +remote: Counting objects: 100% (146/146), done. +remote: Compressing objects: 100% (106/106), done. +remote: Total 533 (delta 54), reused 101 (delta 29), pack-reused 387 +Receiving objects: 100% (533/533), 187.43 KiB | 2.53 MiB/s, done. +Resolving deltas: 100% (186/186), done. +$ ls site_name +admin-tools cloud-console lma openstack service-mesh +``` + ## Example base(1) + site(2) => [variant](https://kubectl.docs.kubernetes.io/references/kustomize/glossary/#variant)(3) diff --git a/create_site.sh b/create_site.sh new file mode 100755 index 0000000..7866747 --- /dev/null +++ b/create_site.sh @@ -0,0 +1,23 @@ +#!/bin/bash +DECAPOD_BASE_URL=https://github.com/openinfradev/decapod-base-yaml.git +BRANCH="main" + +if [ $# -eq 0 ]; then + echo 'Error: Missing Arguments "site name"' + exit 1 +fi +SITE_NAME=$1 + +git clone $DECAPOD_BASE_URL .base-yaml +for i in `ls -d .base-yaml/*/ | grep -v docs | sed 's/.base-yaml\///g'` +do + mkdir -p $SITE_NAME/$i + cp .base-yaml/${i}base/site-values.yaml $SITE_NAME/$i + kustomization="$SITE_NAME/${i}kustomization.yaml" + echo "resources:" > $kustomization + echo " - ../base" >> $kustomization + echo "transformers:" >> $kustomization + echo " - site-values.yaml" >> $kustomization +done + +rm -rf .base-yaml \ No newline at end of file