Skip to content

Commit

Permalink
Rpmpackstrapupdate 2020 08 04 (#64)
Browse files Browse the repository at this point in the history
* Adding some istio options

* Update rpmpackstrap

* istioValues

* centos8

* parse_opts

* centos8script

* basename

* Accomodate 8

* ceph-common

* extraupdate

* Removing missing packages from centos8

* centos8 runtime

* Error: Nothing to do

* y

* apply

* xenial

* Adding crio method to pax

* rook

* exitnormal

* detect
  • Loading branch information
joshuacox authored Aug 10, 2020
1 parent 49b306d commit 3dcefa6
Show file tree
Hide file tree
Showing 16 changed files with 960 additions and 125 deletions.
20 changes: 19 additions & 1 deletion lib/istio.bash
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
#!/usr/bin/env bash
do_istio () {

kubectl apply -f - <<EOF
apiVersion: v1
kind: Secret
metadata:
name: default-secret
annotations:
kubernetes.io/service-account.name: default
type: kubernetes.io/service-account-token
EOF


KUBECONFIG=$KUBECONFIG \
istioctl install --set profile=$ISTIO_PROFILE
istioctl install \
--set profile=$ISTIO_PROFILE \
--set values.kiali.enabled=true \
--set values.tracing.enabled=true \
--set "values.kiali.dashboard.jaegerURL=http://jaeger-query:16686" \
--set "values.global.tracer.zipkin.address=jaeger-collector:9411" \
--set "values.kiali.dashboard.grafanaURL=http://grafana:3000"

KUBECONFIG=$KUBECONFIG \
kubectl label namespace default --overwrite istio-injection=enabled
Expand Down
31 changes: 26 additions & 5 deletions lib/kattic.bash
Original file line number Diff line number Diff line change
Expand Up @@ -576,13 +576,34 @@ do_efk () {

do_rook () {
# Ceph
kubectl --kubeconfig=$KUBECONFIG create -f \
https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/common.yaml
kubectl --kubeconfig=$KUBECONFIG create -f \
https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/operator.yaml
#kubectl --kubeconfig=$KUBECONFIG apply -f \
#https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/common.yaml
#kubectl --kubeconfig=$KUBECONFIG apply -f \
#https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/operator.yaml
#kubectl --kubeconfig=$KUBECONFIG apply -f \
#https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/cluster.yaml
#kubectl --kubeconfig=$KUBECONFIG apply -f \
#https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/ceph/toolbox.yaml
# Ceph
kubectl --kubeconfig=$KUBECONFIG apply -f \
$KUBASH_DIR/submodules/rook/cluster/examples/kubernetes/ceph/common.yaml
kubectl --kubeconfig=$KUBECONFIG apply -f \
$KUBASH_DIR/submodules/rook/cluster/examples/kubernetes/ceph/operator.yaml
$KUBASH_DIR/w8s/generic.w8 rook-ceph-operator rook-ceph
$KUBASH_DIR/w8s/generic.w8 rook-discover rook-ceph
kubectl --kubeconfig=$KUBECONFIG apply -f \
$KUBASH_DIR/submodules/rook/cluster/examples/kubernetes/ceph/cluster.yaml
$KUBASH_DIR/w8s/generic.w8 csi-rbdplugin rook-ceph
$KUBASH_DIR/w8s/generic.w8 rook-ceph-mon rook-ceph
$KUBASH_DIR/w8s/generic.w8 rook-ceph-crashcollector rook-ceph
$KUBASH_DIR/w8s/generic.w8 csi-cephfsplugin-provisioner rook-ceph
kubectl --kubeconfig=$KUBECONFIG apply -f \
$KUBASH_DIR/submodules/rook/cluster/examples/kubernetes/ceph/pool.yaml
kubectl --kubeconfig=$KUBECONFIG apply -f \
$KUBASH_DIR/submodules/rook/cluster/examples/kubernetes/ceph/toolbox.yaml

# cassandra
kubectl --kubeconfig=$KUBECONFIG create -f \
kubectl --kubeconfig=$KUBECONFIG apply -f \
https://raw.githubusercontent.com/rook/rook/master/cluster/examples/kubernetes/cassandra/operator.yaml
}

Expand Down
7 changes: 7 additions & 0 deletions lib/parse_opts.bash
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,13 @@ parse_opts () {
target_build=centos7$build_num
packer_create_pax_dir 'centos7' $build_num
fi
elif [[ "$target_os" =~ 'centos8' ]]; then
if [[ -z "$target_build" ]]; then
echo "matching $target_os"
build_num=$(echo $target_os | sed 's/centos8//')
target_build=centos8$build_num
packer_create_pax_dir 'centos8' $build_num
fi
elif [[ "$target_os" =~ 'stretch' ]]; then
if [[ -z "$target_build" ]]; then
echo "matching $target_os"
Expand Down
30 changes: 29 additions & 1 deletion pax/packstrap
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ TMP=$(mktemp -d)
# this one is for customization
: ${ADDITIONAL_DEB_PACKAGES_TO_INSTALL:='NIL'}

#: ${DOCKER_PKG:='17.03'}
#: ${DOCKER_PKG:='19.03'}
: ${DOCKER_COMPOSE_PKG:='1.8.0'}
: ${KUBEPKG_VERSION:="1.9.3"}
: ${ETCD_VERSION:="3.2.17"}
Expand Down Expand Up @@ -110,6 +110,34 @@ install_spec_docker () {
install_pips
}

install_kubernetes_crio () {
modprobe overlay
modprobe br_netfilter

# Set up required sysctl params, these persist across reboots.
cat > /etc/sysctl.d/99-kubernetes-cri.conf <<EOF
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF

sysctl --system

# Configure package repository
if [[ $NAME == 'Ubuntu' ]]; then
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O- | sudo apt-key add -
elif [[ $NAME == 'Debian' ]]; then
echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/Debian_10/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/Debian_10/Release.key -O- | sudo apt-key add -
fi
sudo apt-get update
# Install CRI-O
sudo apt-get -y install cri-o-1.17

systemctl daemon-reload
systemctl enable --now crio
}

install_kubernetes_docker () {
# Follows the official install guide for ubuntu
Expand Down
68 changes: 56 additions & 12 deletions pax/rpmpackstrap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# https://github.com/cookeem/kubeadm-ha
TMP=$(mktemp -d)
: ${PRE_INSTALL_PKGS:='epel-release'}
: ${INSTALL_PKGS:='ceph-common zsh sysstat fail2ban unzip device-mapper-persistent-data lvm2 golang ebtables ethtool keepalived ntp rsync ansible socat python python-pip wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct iscsi-initiator-utils scsi-target-utils yum-utils'}
: ${ADDITIONAL_INSTALL_PKGS:=' '}
: ${DOCKER_PKG:='18.06.2.ce-3'}
: ${DOCKER_PKG_NAME:="docker-ce-${DOCKER_PKG}"}
Expand All @@ -12,9 +11,18 @@ TMP=$(mktemp -d)
: ${KUBELET_PKG:="kubelet-$KUBEPKG_VERSION"}
: ${KUBEADM_PKG:="kubeadm-$KUBEPKG_VERSION"}
: ${KUBECTL_PKG:="kubectl-$KUBEPKG_VERSION"}
: ${ETCD_PKG="etcd-$ETCD_VERSION"}
: ${ETCD_PKG:="etcd-$ETCD_VERSION"}
#: ${DOCKER_CGROUP_DRIVER:='systemd'}
: ${DOCKER_CGROUP_DRIVER:='cgroupfs'}
: ${CEPH_RELEASE:="luminous"}
. /etc/os-release

if [[ "$PRETTY_NAME" == "CentOS Linux 7 (Core)" ]]; then
: ${INSTALL_PKGS:='zsh sysstat fail2ban unzip device-mapper-persistent-data lvm2 golang ebtables ethtool keepalived ntp rsync ansible socat python python-pip wget git net-tools bind-utils iptables-services bridge-utils bash-completion kexec-tools sos psacct iscsi-initiator-utils scsi-target-utils yum-utils'}
elif [[ "$PRETTY_NAME" == "CentOS Linux 8 (Core)" ]]; then
# https://www.tecmint.com/create-network-bridge-in-rhel-centos-8/
: ${INSTALL_PKGS:='zsh sysstat fail2ban unzip device-mapper-persistent-data lvm2 golang ebtables ethtool keepalived chrony rsync ansible socat python2-pip python3-pip wget git net-tools bind-utils iptables-services bash-completion kexec-tools sos psacct iscsi-initiator-utils yum-utils'}
fi

cd $TMP
cat <<EOF > $TMP/inventory
Expand Down Expand Up @@ -68,14 +76,20 @@ sysctl --system
iptables -F
iptables-save

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y epel-release-latest-7.noarch.rpm
if [[ "$PRETTY_NAME" == "CentOS Linux 7 (Core)" ]]; then
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install -y epel-release-latest-7.noarch.rpm
elif [[ "$PRETTY_NAME" == "CentOS Linux 8 (Core)" ]]; then
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
yum install -y epel-release-latest-8.noarch.rpm
fi

yum clean all
yum update -y
yum repolist enabled

yum install -y $PRE_INSTALL_PKGS
yum update -y
yum install -y $INSTALL_PKGS $ADDITIONAL_INSTALL_PKGS

systemctl enable sysstat.service
Expand Down Expand Up @@ -110,6 +124,25 @@ install_default_docker () {
/etc/sysconfig/docker
}

install_ceph () {
if [[ "$PRETTY_NAME" == "CentOS Linux 7 (Core)" ]]; then
#sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
cat << EOM > /etc/yum.repos.d/ceph.repo
[ceph-noarch]
name=Ceph noarch packages
baseurl=https://download.ceph.com/rpm-$CEPH_RELEASE/el7/noarch
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=https://download.ceph.com/keys/release.asc
EOM
sudo yum update -y
sudo yum install -y ceph-common
elif [[ "$PRETTY_NAME" == "CentOS Linux 8 (Core)" ]]; then
echo 'pass as ceph does not have a release for centos8'
fi
}

install_spec_docker () {
# Install docker
sudo yum-config-manager \
Expand Down Expand Up @@ -139,18 +172,28 @@ install_kubernetes_docker () {
## Set up the repository
### Install required packages.
yum install -y yum-utils device-mapper-persistent-data lvm2

### Add Docker repository.
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo

## Install Docker CE.
yum update -y && yum install -y docker-ce-18.06.2.ce


if [[ "$PRETTY_NAME" == "CentOS Linux 7 (Core)" ]]; then
# Install Docker CE
yum update -y && yum install -y \
containerd.io-1.2.13 \
docker-ce-19.03.11 \
docker-ce-cli-19.03.11
elif [[ "$PRETTY_NAME" == "CentOS Linux 8 (Core)" ]]; then
yum update -y && yum install -y \
containerd.io \
docker-ce \
docker-ce-cli
fi

## Create /etc/docker directory.
mkdir /etc/docker

# Setup daemon.
cat > /etc/docker/daemon.json <<EOF
{
Expand All @@ -165,9 +208,9 @@ install_kubernetes_docker () {
]
}
EOF

mkdir -p /etc/systemd/system/docker.service.d

# Restart Docker
systemctl daemon-reload
systemctl enable --now docker
Expand Down Expand Up @@ -227,6 +270,7 @@ elif [ "$KUBEADM_INSTALL" = "kubeadm" ]; then
#install_spec_docker
install_kubernetes_docker
install_kube_tools
install_ceph
#kubeadm config images pull
#kubeadm init
#yes y|kubeadm reset
Expand Down
24 changes: 24 additions & 0 deletions scripts/centos8
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
set -eux
if [ $# -ne 1 ]; then
# Print usage
echo 'Error! wrong number of arguments'
echo 'usage:'
echo "$0 kube_version"
exit 1
fi
THIS_OS=centos8
KUBE_VERSION=$1
if [[ -e pax/${THIS_OS}${KUBE_VERSION} ]]; then
echo 'directory already exists! exiting softly'
exit 0
fi
cp -av templates/${THIS_OS}-kube.tpl pax/${THIS_OS}${KUBE_VERSION}
cd pax/${THIS_OS}${KUBE_VERSION}
if [[ -e $KUBASH_DIR/.packer_cache_path ]]; then
PACKER_CACHE_PATH=$(cat $KUBASH_DIR/.packer_cache_path)
ln -s $PACKER_CACHE_PATH ./packer_cache
fi
mv ${THIS_OS}REPLACEME_KUBE_VERSION.json ${THIS_OS}${KUBE_VERSION}.json
sed -i "s/REPLACEME_KUBE_VERSION/${KUBE_VERSION}/g" ${THIS_OS}${KUBE_VERSION}.json

Loading

0 comments on commit 3dcefa6

Please sign in to comment.