-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·45 lines (34 loc) · 1.41 KB
/
bootstrap.sh
File metadata and controls
executable file
·45 lines (34 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Copy operator yaml file from the google cloud bucket
gsutil cp gs://config-management-release/released/latest/config-sync-operator.yaml config-sync-operator.yaml
# Install operator
kubectl apply -f config-sync-operator.yaml
if [ `ls | grep keys | wc -l` -eq 0 ]
then
mkdir keys
echo "keys dir has been created"
else
echo "keys dir has been detected"
fi
# Generate the key or plase your personal keys in ./keys directory
if [ `ls keys | wc -l` -eq 0 ]
then
ssh-keygen -q -t rsa -N '' -f ./keys/git-creds 2>/dev/null <<< y >/dev/null
echo "Don't forget attach your public ssh key to the git accout/repo"
else
echo "Keys directory alredy exist, checkhing existance of the K8S secret"
fi
# Create K8S secret from file if not yet exist
SECRET_EXISTS=$(kubectl get secret git-creds -n config-management-system --no-headers --output=go-template={{.metadata.name}} 2>/dev/null)
if [ -z "${SECRET_EXISTS}" ]
then
kubectl create secret generic git-creds --namespace=config-management-system --from-file=ssh=./keys/git-creds
else
echo "Secret private key is already exists as a K8S secret"
fi
# Nomos installation
gsutil cp gs://config-management-release/released/latest/darwin_amd64/nomos /usr/local/bin/nomos && chmod +x /usr/local/bin/nomos
# Config-management repo configuration installation via CRD
kubectl apply -f config-management.yaml
# Nomos validation
nomos vet --path=./config-sync