Skip to content

Commit

Permalink
Merge pull request #1 from openinfradev/add_create_script
Browse files Browse the repository at this point in the history
add new script to create site
  • Loading branch information
intelliguy authored Jun 7, 2021
2 parents 506ff3b + 754d15c commit 03b4cb3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
23 changes: 23 additions & 0 deletions create_site.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 03b4cb3

Please sign in to comment.