Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Raffaele Spazzoli <[email protected]>
  • Loading branch information
raffaelespazzoli committed Aug 17, 2020
1 parent 244e724 commit 745337c
Show file tree
Hide file tree
Showing 6 changed files with 299 additions and 3 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ misc4.0/htpasswd/htpasswd
4.0/config/pullsecret.yaml

misc4.0/vault/values.yaml
4.0/cluster1-acm/tls/journal-gatewayd.key
4.0/cluster1-acm/tls/journal-gatewayd.crt
4.0/config/config-acm/journal-gatewayd.key
4.0/config/config-acm/journal-gatewayd.crt
4.0/cluster2-acm/metadata.json
2 changes: 1 addition & 1 deletion 4.0/.gitignore
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
212 changes: 212 additions & 0 deletions 4.0/cluster2-acm/.openshift_install.log

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions 4.0/instance_mgm.sh
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
23 changes: 23 additions & 0 deletions 4.0/setup-acm.sh
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
23 changes: 23 additions & 0 deletions 4.0/setup-eng.sh
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

0 comments on commit 745337c

Please sign in to comment.