-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Raffaele Spazzoli <[email protected]>
- Loading branch information
1 parent
244e724
commit 745337c
Showing
6 changed files
with
299 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/auth/ | ||
/cluster1/ | ||
/cluster-azure1/ | ||
/cluster-acm/ | ||
/cluster1-acm/ | ||
/cluster2/ | ||
/users.htpasswd | ||
/openshift-install |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#this function receves in input a list of cluster ids as found in the tag: kubernetes.io/cluster/<id>: owned | ||
|
||
set -o nounset | ||
set -o errexit | ||
|
||
function stop() { | ||
for region in us-east-1 us-east-2 us-west-1 us-west-2; do | ||
for clusterid in $@; do | ||
instances=$(aws --region ${region} ec2 describe-instances --filters "Name=tag:kubernetes.io/cluster/${clusterid},Values=owned" | jq -r .Reservations[].Instances[].InstanceId | tr "\n" " ") | ||
if [ ! -z "${instances}" ]; then | ||
aws --region ${region} ec2 stop-instances --instance-ids ${instances} | ||
fi | ||
done | ||
done | ||
} | ||
|
||
function start() { | ||
for region in us-east-1 us-east-2 us-west-1 us-west-2; do | ||
for clusterid in $@; do | ||
instances=$(aws --region ${region} ec2 describe-instances --filters "Name=tag:kubernetes.io/cluster/${clusterid},Values=owned" | jq -r .Reservations[].Instances[].InstanceId | tr "\n" " ") | ||
echo for region $region found instances $instances | ||
if [ ! -z "${instances}" ]; then | ||
aws --region ${region} ec2 start-instances --instance-ids ${instances} | ||
fi | ||
done | ||
done | ||
} | ||
|
||
if [ "$1" == "start" ]; then | ||
shift | ||
start $@ | ||
fi | ||
|
||
if [ "$1" == "stop" ]; then | ||
shift | ||
stop $@ | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
set -o nounset | ||
set -o errexit | ||
|
||
function create_openshift() | ||
{ | ||
mkdir -p ./cluster$CLUSTER_ID | ||
cp ./config/config-acm/install-config-raffa$CLUSTER_ID.yaml ./cluster$CLUSTER_ID/install-config.yaml | ||
#~/Downloads/openshift-install-linux-4.4.0-0.nightly-2020-02-17-103442/openshift-install create cluster --dir ./cluster$CLUSTER_ID --log-level debug | ||
openshift-install create cluster --dir ./cluster$CLUSTER_ID --log-level debug | ||
export KUBECONFIG=/home/rspazzol/git/openshift-enablement-exam/4.0/cluster${CLUSTER_ID}/auth/kubeconfig | ||
# create route | ||
oc create route reencrypt apiserver --service kubernetes --port https -n default | ||
# add simple user | ||
htpasswd -c -B -b ./cluster$CLUSTER_ID/auth/htpasswd raffa raffa | ||
oc create secret generic htpass-secret --from-file=htpasswd=./cluster$CLUSTER_ID/auth/htpasswd -n openshift-config | ||
oc apply -f ../misc4.0/htpasswd/oauth.yaml -n openshift-config | ||
oc adm policy add-cluster-role-to-user cluster-admin raffa | ||
} | ||
|
||
#download_installer | ||
#configure_aws_credentials | ||
CLUSTER_ID=1-acm create_openshift | ||
#CLUSTER_ID=2 create_openshift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
set -o nounset | ||
set -o errexit | ||
|
||
function create_openshift() | ||
{ | ||
mkdir -p ./cluster$CLUSTER_ID | ||
cp ./config/install-config-raffa$CLUSTER_ID.yaml ./cluster$CLUSTER_ID/install-config.yaml | ||
#~/Downloads/openshift-install-linux-4.4.0-0.nightly-2020-02-17-103442/openshift-install create cluster --dir ./cluster$CLUSTER_ID --log-level debug | ||
openshift-install create cluster --dir ./cluster$CLUSTER_ID --log-level debug | ||
export KUBECONFIG=/home/rspazzol/git/openshift-enablement-exam/4.0/cluster${CLUSTER_ID}/auth/kubeconfig | ||
# create route | ||
oc create route reencrypt apiserver --service kubernetes --port https -n default | ||
# add simple user | ||
htpasswd -c -B -b ./cluster$CLUSTER_ID/auth/htpasswd raffa raffa | ||
oc create secret generic htpass-secret --from-file=htpasswd=./cluster$CLUSTER_ID/auth/htpasswd -n openshift-config | ||
oc apply -f ../misc4.0/htpasswd/oauth.yaml -n openshift-config | ||
oc adm policy add-cluster-role-to-user cluster-admin raffa | ||
} | ||
|
||
#download_installer | ||
#configure_aws_credentials | ||
CLUSTER_ID=1-eng create_openshift | ||
#CLUSTER_ID=2 create_openshift |