Skip to content

Commit c8fac6e

Browse files
committed
updates
1 parent ee2e842 commit c8fac6e

11 files changed

+686
-1
lines changed

K8/AWS/setupvm.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ HOSTED_ZONE=screeley.sysdeseng.com
5454
KOPS_CLUSTERNAME=""
5555
BUCKET_NAME=""
5656
S3_KOPS=s3://
57-
KOPS_RELEASE=1.15.0-alpha.1
57+
KOPS_RELEASE=1.15.2
5858
#KOPS_RELEASE=1.13.0
5959

6060
# Workspace Env Vars

K8/Alpine_Container/wrapper.sh

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# This script will install OCP on AWS
2+
# this is being injected into a container
3+
4+
5+
# Environment Variables and Parameters
6+
CLUSTER_NAME=screeley-test1
7+
BASE_DOMAIN=sysdeseng.com
8+
INSTALLER_VERSION="4.2.2"
9+
INSTALLER_TAR="openshift-install-linux-4.2.2.tar.gz"
10+
CLIENT_TAR="openshift-client-linux-4.2.2.tar.gz"
11+
AWSKEY=AKIA5VNKVVT5JERPYOKN
12+
AWSSECRET=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
13+
ZONE=us-east-1
14+
pS=$(cat /tmp/cluster/secrets/pullsecret.json)
15+
16+
# create working directory
17+
cd /tmp
18+
mkdir -p /tmp/$CLUSTER_NAME
19+
cd /tmp/$CLUSTER_NAME
20+
21+
# install any prereqs
22+
apk add --no-cache g++ python3-dev py-pip libffi-dev openssl-dev openssh >/dev/null 2>&1
23+
24+
#install and configure aws cli
25+
pip3 install awscli >/dev/null 2>&1
26+
echo "$AWSKEY" > myconf.txt
27+
echo "$AWSSECRET" >> myconf.txt
28+
echo "$ZONE" >> myconf.txt
29+
echo "json" >> myconf.txt
30+
aws configure < myconf.txt >/dev/null 2>&1
31+
32+
#setup ssh
33+
ssh-keygen -f id_rsa -t rsa -N '' >/dev/null 2>&1
34+
SSHVALUE=$(cat /root/.ssh/id_rsa.pub)
35+
36+
# Get openshift-installer and client
37+
wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$INSTALLER_VERSION/$INSTALLER_TAR >/dev/null 2>&1
38+
tar -xzf $INSTALLER_TAR >/dev/null 2>&1
39+
chmod +x openshift-install
40+
41+
wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$INSTALLER_VERSION/$CLIENT_TAR >/dev/null 2>&1
42+
rm -rf /usr/local/bin/oc
43+
tar -C /usr/local/bin -xzf $CLIENT_TAR >/dev/null 2>&1
44+
45+
echo "apiVersion: v1" > install-config.yaml
46+
echo "baseDomain: $BASE_DOMAIN" >> install-config.yaml
47+
echo "compute:" >> install-config.yaml
48+
echo "- hyperthreading: Enabled" >> install-config.yaml
49+
echo " name: worker" >> install-config.yaml
50+
echo " platform:" >> install-config.yaml
51+
echo " aws:" >> install-config.yaml
52+
echo " type: c5.4xlarge" >> install-config.yaml
53+
echo " zones:" >> install-config.yaml
54+
echo " - us-east-1d" >> install-config.yaml
55+
echo " replicas: 2" >> install-config.yaml
56+
echo "controlPlane:" >> install-config.yaml
57+
echo " hyperthreading: Enabled" >> install-config.yaml
58+
echo " name: master" >> install-config.yaml
59+
echo " platform:" >> install-config.yaml
60+
echo " aws:" >> install-config.yaml
61+
echo " zones:" >> install-config.yaml
62+
echo " - us-east-1d" >> install-config.yaml
63+
echo " replicas: 1" >> install-config.yaml
64+
echo "metadata:" >> install-config.yaml
65+
echo " creationTimestamp: null" >> install-config.yaml
66+
echo " name: $CLUSTER_NAME" >> install-config.yaml
67+
echo "networking:" >> install-config.yaml
68+
echo " clusterNetwork:" >> install-config.yaml
69+
echo " - cidr: 10.128.0.0/14" >> install-config.yaml
70+
echo " hostPrefix: 23" >> install-config.yaml
71+
echo " machineCIDR: 10.0.0.0/16" >> install-config.yaml
72+
echo " networkType: OpenshiftSDN" >> install-config.yaml
73+
echo " serviceNetwork:" >> install-config.yaml
74+
echo " - 172.30.0.0/16" >> install-config.yaml
75+
echo "platform:" >> install-config.yaml
76+
echo " aws:" >> install-config.yaml
77+
echo " region: $ZONE" >> install-config.yaml
78+
echo "pullSecret: '$pS'" >> install-config.yaml
79+
echo "sshKey: \"$SSHVALUE\"" >> install-config.yaml
80+
81+
./openshift-install create cluster --dir /tmp/$CLUSTER_NAME
82+
83+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: ghost
5+
labels:
6+
role: blog
7+
spec:
8+
replicas: 1
9+
template:
10+
metadata:
11+
labels:
12+
role: blog
13+
spec:
14+
containers:
15+
- name: ghost
16+
image: ghost:0.11-alpine
17+
command: ["/scripts/wrapper.sh"]
18+
ports:
19+
- name: ghost
20+
containerPort: 2368
21+
protocol: TCP
22+
volumeMounts:
23+
- name: wrapper
24+
mountPath: /scripts
25+
volumes:
26+
- name: wrapper
27+
configMap:
28+
name: wrapper
29+
defaultMode: 0744
30+
31+
32+
apiVersion: v1
33+
kind: Pod
34+
metadata:
35+
name: alpine
36+
namespace: default
37+
spec:
38+
containers:
39+
- image: alpine:3.2
40+
command:
41+
- /bin/sh
42+
- "-c"
43+
- "sleep 60m"
44+
imagePullPolicy: IfNotPresent
45+
name: alpine
46+
restartPolicy: Always
47+
48+
apiVersion: v1
49+
kind: Pod
50+
metadata:
51+
name: alpine1
52+
namespace: default
53+
spec:
54+
containers:
55+
- image: alpine:latest
56+
command: ["/bin/sh","-c"]
57+
args: ["-ec", "while :; do echo '.'; sleep 5 ; done"]
58+
imagePullPolicy: Always
59+
name: alpine1
60+
restartPolicy: Always
61+
62+
apiVersion: v1
63+
kind: Pod
64+
metadata:
65+
name: alpine2
66+
namespace: default
67+
spec:
68+
containers:
69+
- image: alpine:latest
70+
imagePullPolicy: Always
71+
name: alpine2
72+
command: ["/scripts/wrapper.sh"]
73+
volumeMounts:
74+
- name: wrapper
75+
mountPath: /scripts
76+
volumes:
77+
- name: wrapper
78+
configMap:
79+
name: wrapper
80+
defaultMode: 0744
81+
restartPolicy: Always
82+
83+
84+
85+
86+

K8/centos_container/wrapper.sh

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#! /bin/bash
2+
# This script will install OCP on AWS
3+
# this is being injected into a container
4+
5+
6+
# Environment Variables and Parameters
7+
CLUSTER_NAME=screeley-test1
8+
BASE_DOMAIN=sysdeseng.com
9+
INSTALLER_VERSION="4.2.2"
10+
INSTALLER_TAR="openshift-install-linux-4.2.2.tar.gz"
11+
CLIENT_TAR="openshift-client-linux-4.2.2.tar.gz"
12+
AWSKEY=AKIA5VNKVVT5JERPYOKN
13+
AWSSECRET=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
14+
ZONE=us-east-1
15+
pS=$(cat /tmp/cluster/secrets/pullsecret.json)
16+
17+
# create working directory
18+
cd /tmp
19+
mkdir -p /tmp/$CLUSTER_NAME
20+
cd /tmp/$CLUSTER_NAME
21+
22+
# install any prereqs
23+
yum install wget openssh python2-pip python3-pip -y >/dev/null 2>&1
24+
25+
#install and configure aws cli
26+
pip3 install awscli >/dev/null 2>&1
27+
echo "$AWSKEY" > myconf.txt
28+
echo "$AWSSECRET" >> myconf.txt
29+
echo "$ZONE" >> myconf.txt
30+
echo "json" >> myconf.txt
31+
aws configure < myconf.txt >/dev/null 2>&1
32+
33+
export AWS_ACCESS_KEY_ID=$AWSKEY
34+
export AWS_SECRET_ACCESS_KEY=$AWSSECRET
35+
36+
#setup ssh
37+
ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''
38+
SSHVALUE=$(cat /root/.ssh/id_rsa.pub)
39+
40+
# Get openshift-installer and client
41+
wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$INSTALLER_VERSION/$INSTALLER_TAR >/dev/null 2>&1
42+
tar -xzf $INSTALLER_TAR >/dev/null 2>&1
43+
chmod +x openshift-install
44+
45+
wget https://mirror.openshift.com/pub/openshift-v4/clients/ocp/$INSTALLER_VERSION/$CLIENT_TAR >/dev/null 2>&1
46+
rm -rf /usr/local/bin/oc
47+
tar -C /usr/local/bin -xzf $CLIENT_TAR >/dev/null 2>&1
48+
49+
echo "apiVersion: v1" > install-config.yaml
50+
echo "baseDomain: $BASE_DOMAIN" >> install-config.yaml
51+
echo "compute:" >> install-config.yaml
52+
echo "- hyperthreading: Enabled" >> install-config.yaml
53+
echo " name: worker" >> install-config.yaml
54+
echo " platform:" >> install-config.yaml
55+
echo " aws:" >> install-config.yaml
56+
echo " type: c5.4xlarge" >> install-config.yaml
57+
echo " zones:" >> install-config.yaml
58+
echo " - us-east-1d" >> install-config.yaml
59+
echo " replicas: 2" >> install-config.yaml
60+
echo "controlPlane:" >> install-config.yaml
61+
echo " hyperthreading: Enabled" >> install-config.yaml
62+
echo " name: master" >> install-config.yaml
63+
echo " platform:" >> install-config.yaml
64+
echo " aws:" >> install-config.yaml
65+
echo " zones:" >> install-config.yaml
66+
echo " - us-east-1d" >> install-config.yaml
67+
echo " replicas: 1" >> install-config.yaml
68+
echo "metadata:" >> install-config.yaml
69+
echo " creationTimestamp: null" >> install-config.yaml
70+
echo " name: $CLUSTER_NAME" >> install-config.yaml
71+
echo "networking:" >> install-config.yaml
72+
echo " clusterNetwork:" >> install-config.yaml
73+
echo " - cidr: 10.128.0.0/14" >> install-config.yaml
74+
echo " hostPrefix: 23" >> install-config.yaml
75+
echo " machineCIDR: 10.0.0.0/16" >> install-config.yaml
76+
echo " networkType: OpenshiftSDN" >> install-config.yaml
77+
echo " serviceNetwork:" >> install-config.yaml
78+
echo " - 172.30.0.0/16" >> install-config.yaml
79+
echo "platform:" >> install-config.yaml
80+
echo " aws:" >> install-config.yaml
81+
echo " region: $ZONE" >> install-config.yaml
82+
echo "pullSecret: '$pS'" >> install-config.yaml
83+
echo "sshKey: \"$SSHVALUE\"" >> install-config.yaml
84+
85+
./openshift-install create cluster --dir /tmp/$CLUSTER_NAME > install-log.txt
86+

PSI/SetUpOCP.sh

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#! /bin/bash
2+
# Some automation to setting up OSE/K8 VM's
3+
# For RHEL Environments
4+
5+
6+
SCRIPT_HOME="$(realpath $(dirname $0))"
7+
CONFIG_HOME=""
8+
9+
if [ -f "$SCRIPT_HOME/setupvm.config" ]
10+
then
11+
CONFIG_HOME=$SCRIPT_HOME
12+
else
13+
CONFIG_HOME="${HOME}/${CLUSTER_NAME}/setupvm.config"
14+
fi
15+
16+
source $CONFIG_HOME/setupvm.config
17+
SUDO=""
18+
19+
#Perform Basic Host Configuration
20+
echo "................................."
21+
echo " Configuring Host Env"
22+
echo "................................."
23+
source $CONFIG_HOME/../../lib/host-config.sh
24+
25+
26+
#PSI Prereqs
27+
# - Install OCP Installer and Client
28+
# - remove previous instances
29+
# - install latest
30+
31+
32+
33+
34+
#RHSM
35+
echo ""
36+
echo "................................."
37+
echo " Registering System with RHSM"
38+
echo "................................."
39+
source $CONFIG_HOME/../../lib/rhsm.sh
40+
41+
42+
# Install core software (go, etcd, docker, etc...)
43+
echo ""
44+
echo "................................."
45+
echo " Installing Host PreReqs"
46+
echo "................................."
47+
echo " ... ... Installing Base Software"
48+
source $CONFIG_HOME/../../lib/yum-rhel-4.sh
49+
echo " ... ... Installing Go-$GOVERSION"
50+
source $CONFIG_HOME/../../lib/install-go.sh
51+
#echo " ... ... Installing etcd-$ETCD_VER"
52+
#source $CONFIG_HOME/../../lib/install-etcd.sh
53+
echo " ... ... Installing Docker-$DOCKERVER"
54+
source $CONFIG_HOME/../../lib/docker-base.sh
55+
56+
echo ""
57+
echo "................................."
58+
echo " Configuring Docker"
59+
echo "................................."
60+
#if [ "$APP_TYPE" == "origin" ] && [ "$HOSTENV" == "rhel" ]
61+
#then
62+
# source $CONFIG_HOME/../../lib/docker-registry.sh
63+
#fi
64+
source $CONFIG_HOME/../../lib/docker-restart.sh
65+
66+
67+
# Clone Repos
68+
echo "................................."
69+
echo " Cloning Repos"
70+
echo "................................."
71+
source $CONFIG_HOME/../../lib/clone-repos.sh
72+
echo ""
73+
74+
# Create Profiles
75+
echo "................................."
76+
echo " Setting Bash Environment"
77+
echo "................................."
78+
source $CONFIG_HOME/../../lib/bash-profile-4.sh
79+
echo ""
80+
81+
# Cloud Config
82+
if [ "$ISCLOUD" == "aws" ] || [ "$ISCLOUD" == "gce" ]
83+
then
84+
echo "................................."
85+
echo " Performing Cloud Configurations"
86+
echo "................................."
87+
source $CONFIG_HOME/../../lib/cloud-config.sh
88+
echo ""
89+
fi
90+
91+
92+
# Post Install
93+
echo "................................."
94+
echo " Performing Post Configurations"
95+
echo "................................."
96+
source $CONFIG_HOME/../../lib/post-install.sh
97+
echo ""
98+
99+
# This is a common issue I've run into
100+
# export PATH=$PATH:$GOPATH/bin; go get -u github.com/cloudflare/cfssl/cmd/...
101+
102+
103+
echo ""
104+
echo " *********************************************** "
105+
echo ""
106+
echo " Script Complete! Origin RHEL Setup Completed on host $HOSTNAME!"
107+
echo ""
108+
echo " *********************************************** "

0 commit comments

Comments
 (0)