mirror of
https://github.com/clearlinux/cloud-native-setup.git
synced 2026-08-18 21:16:16 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| df50ad11ce | |||
| cf9b85cf03 | |||
| a82b9d9601 | |||
| 96978c5228 | |||
| 8c17c4b47c | |||
| 514efd6592 | |||
| 603c42703f |
Vendored
+56
@@ -0,0 +1,56 @@
|
||||
pipeline {
|
||||
agent {
|
||||
label 'clearlinux'
|
||||
}
|
||||
options {
|
||||
timeout(time: 1, unit: "HOURS")
|
||||
}
|
||||
triggers {
|
||||
cron('H */12 * * *')
|
||||
}
|
||||
environment {
|
||||
CLR_K8S_PATH="${env.WORKSPACE}/clr-k8s-examples"
|
||||
}
|
||||
stages {
|
||||
stage('Setup system') {
|
||||
steps {
|
||||
dir(path: "$CLR_K8S_PATH") {
|
||||
sh './setup_system.sh'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Init') {
|
||||
steps {
|
||||
dir(path: "$CLR_K8S_PATH") {
|
||||
sh './create_stack.sh init'
|
||||
sh 'mkdir -p $HOME/.kube'
|
||||
sh 'sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config'
|
||||
sh 'sudo chown $(id -u):$(id -g) $HOME/.kube/config'
|
||||
sh 'kubectl version'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('CNI') {
|
||||
steps {
|
||||
dir(path: "$CLR_K8S_PATH") {
|
||||
sh './create_stack.sh cni'
|
||||
sh 'kubectl rollout status deployment/coredns -n kube-system --timeout=5m'
|
||||
sh 'kubectl get pods -n kube-system'
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Reset Stack') {
|
||||
steps {
|
||||
dir(path: "$CLR_K8S_PATH") {
|
||||
sh './reset_stack.sh'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
sh 'uname -a'
|
||||
sh 'swupd info'
|
||||
}
|
||||
}
|
||||
}
|
||||
+5
-1
@@ -1,7 +1,11 @@
|
||||
resources:
|
||||
- rook/cluster/examples/kubernetes/ceph/common.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/operator.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/cluster.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/storageclass.yaml
|
||||
|
||||
patchesStrategicMerge:
|
||||
- patch_operator.yaml
|
||||
- patch_operator.yaml
|
||||
# patches rook to use 'directories' instead of partitions.
|
||||
# comment out to use partitions
|
||||
- patch_cephcluster.yaml
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
---
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephCluster
|
||||
metadata:
|
||||
@@ -6,4 +7,4 @@ metadata:
|
||||
spec:
|
||||
storage:
|
||||
directories:
|
||||
- path: /var/lib/rook
|
||||
- path: /var/lib/rook
|
||||
@@ -0,0 +1,10 @@
|
||||
resources:
|
||||
- rook/cluster/examples/kubernetes/ceph/common.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/operator.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/cluster.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/csi/rbd/storageclass.yaml
|
||||
|
||||
patchesStrategicMerge:
|
||||
# patches rook to use 'directories' instead of partitions.
|
||||
# comment out to use partitions
|
||||
- patch_cephcluster.yaml
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephCluster
|
||||
metadata:
|
||||
name: rook-ceph
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
mon:
|
||||
allowMultiplePerNode: true
|
||||
storage:
|
||||
directories:
|
||||
- path: /var/lib/rook
|
||||
---
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephBlockPool
|
||||
metadata:
|
||||
name: replicapool
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
replicated:
|
||||
requireSafeReplicaSize: false
|
||||
size: 1
|
||||
+2
-1
@@ -1,3 +1,4 @@
|
||||
---
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephCluster
|
||||
metadata:
|
||||
@@ -6,4 +7,4 @@ metadata:
|
||||
spec:
|
||||
storage:
|
||||
directories:
|
||||
- path: /var/lib/rook
|
||||
- path: /var/lib/rook
|
||||
@@ -0,0 +1,10 @@
|
||||
resources:
|
||||
- rook/cluster/examples/kubernetes/ceph/common.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/operator.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/cluster.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/csi/rbd/storageclass.yaml
|
||||
|
||||
patchesStrategicMerge:
|
||||
# patches rook to use 'directories' instead of partitions.
|
||||
# comment out to use partitions
|
||||
- patch_cephcluster.yaml
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephCluster
|
||||
metadata:
|
||||
name: rook-ceph
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
mon:
|
||||
allowMultiplePerNode: true
|
||||
storage:
|
||||
directories:
|
||||
- path: /var/lib/rook
|
||||
---
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephBlockPool
|
||||
metadata:
|
||||
name: replicapool
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
replicated:
|
||||
requireSafeReplicaSize: false
|
||||
size: 1
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephCluster
|
||||
metadata:
|
||||
name: rook-ceph
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
storage:
|
||||
directories:
|
||||
- path: /var/lib/rook
|
||||
@@ -0,0 +1,10 @@
|
||||
resources:
|
||||
- rook/cluster/examples/kubernetes/ceph/common.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/operator.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/cluster.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/csi/rbd/storageclass.yaml
|
||||
|
||||
patchesStrategicMerge:
|
||||
# patches rook to use 'directories' instead of partitions.
|
||||
# comment out to use partitions
|
||||
- patch_cephcluster.yaml
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephCluster
|
||||
metadata:
|
||||
name: rook-ceph
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
mon:
|
||||
allowMultiplePerNode: true
|
||||
storage:
|
||||
directories:
|
||||
- path: /var/lib/rook
|
||||
---
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephBlockPool
|
||||
metadata:
|
||||
name: replicapool
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
replicated:
|
||||
requireSafeReplicaSize: false
|
||||
size: 1
|
||||
@@ -0,0 +1,10 @@
|
||||
resources:
|
||||
- rook/cluster/examples/kubernetes/ceph/common.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/operator.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/cluster.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/csi/rbd/storageclass.yaml
|
||||
|
||||
patchesStrategicMerge:
|
||||
# patches rook to use 'directories' instead of partitions.
|
||||
# comment out to use partitions
|
||||
- patch_cephcluster.yaml
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephCluster
|
||||
metadata:
|
||||
name: rook-ceph
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
storage:
|
||||
directories:
|
||||
- path: /var/lib/rook
|
||||
@@ -0,0 +1,10 @@
|
||||
resources:
|
||||
- rook/cluster/examples/kubernetes/ceph/common.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/operator.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/cluster.yaml
|
||||
- rook/cluster/examples/kubernetes/ceph/csi/rbd/storageclass.yaml
|
||||
|
||||
patchesStrategicMerge:
|
||||
# patches rook to use 'directories' instead of partitions.
|
||||
# comment out to use partitions
|
||||
- patch_cephcluster.yaml
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephCluster
|
||||
metadata:
|
||||
name: rook-ceph
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
mon:
|
||||
allowMultiplePerNode: true
|
||||
storage:
|
||||
directories:
|
||||
- path: /var/lib/rook
|
||||
---
|
||||
apiVersion: ceph.rook.io/v1
|
||||
kind: CephBlockPool
|
||||
metadata:
|
||||
name: replicapool
|
||||
namespace: rook-ceph
|
||||
spec:
|
||||
replicated:
|
||||
requireSafeReplicaSize: false
|
||||
size: 1
|
||||
@@ -38,7 +38,7 @@ add_pair_ns() {
|
||||
ln -sfT $CNI_NETNS /var/run/netns/$CNI_CONTAINERID
|
||||
|
||||
ip netns exec $CNI_CONTAINERID ip link add $CNI_IFNAME type veth peer name $peer
|
||||
ip netns exec $CNI_CONTAINERID ip link set $CNI_IFNAME addr $mac up
|
||||
ip netns exec $CNI_CONTAINERID ip link set $CNI_IFNAME addr $mac up alias $vfpci
|
||||
ip netns exec $CNI_CONTAINERID ip link set $peer up
|
||||
ip netns exec $CNI_CONTAINERID ip addr add $ip dev $CNI_IFNAME
|
||||
}
|
||||
|
||||
@@ -162,3 +162,18 @@ Grafana is available at this URL http://localhost:3000 . Default credentials are
|
||||
## Cleaning up the cluster (Hard reset to a clean state)
|
||||
|
||||
Run `reset_stack.sh` on all the nodes
|
||||
|
||||
## Additional Components
|
||||
|
||||
### Rook
|
||||
The default Rook configuration provided is intended for testing purposes only
|
||||
and is not suitable for a production environment. By default Rook is configured
|
||||
to provide local storage (/var/lib/rook) and will be provisioned differently
|
||||
depending on whether or not you startup a single node Kubernetes cluster, or
|
||||
a multiple node Kubernetes cluster.
|
||||
|
||||
- When starting up a single node Kubernetes cluster, Rook will be configured
|
||||
to start up a single replica, and will allow multiple monitors on the same node.
|
||||
- When multiple Kubernetes worker nodes are detected, Rook will be configured
|
||||
to startup a replica on each available node and will schedule monitor processes
|
||||
on separate nodes providing greater reliability.
|
||||
|
||||
@@ -21,7 +21,7 @@ CILIUM_VER="${CLRK8S_CILIUM_VER:-v1.6.4}"
|
||||
FLANNEL_VER="${CLRK8S_FLANNEL_VER:-960b3243b9a7faccdfe7b3c09097105e68030ea7}"
|
||||
K8S_VER="${CLRK8S_K8S_VER:-}"
|
||||
KATA_VER="${CLRK8S_KATA_VER:-1.9.1-kernel-config}"
|
||||
ROOK_VER="${CLRK8S_ROOK_VER:-v1.1.7}"
|
||||
ROOK_VER="${CLRK8S_ROOK_VER:-v1.2.6}"
|
||||
METRICS_VER="${CLRK8S_METRICS_VER:-v0.3.6}"
|
||||
DASHBOARD_VER="${CLRK8S_DASHBOARD_VER:-v2.0.0-beta2}"
|
||||
INGRES_VER="${CLRK8S_INGRES_VER:-nginx-0.26.1}"
|
||||
@@ -33,6 +33,7 @@ CNI=${CLRK8S_CNI:-"canal"}
|
||||
if [[ -z "${RUNNER+x}" ]]; then RUNNER="${CLRK8S_RUNNER:-"crio"}"; fi
|
||||
|
||||
NFD_VER="${CLRK8S_NFD_VER:-v0.4.0}"
|
||||
mode="multinode"
|
||||
|
||||
function print_usage_exit() {
|
||||
exit_code=${1:-0}
|
||||
@@ -108,6 +109,7 @@ function cluster_init() {
|
||||
#Ensure single node k8s works
|
||||
if [ "$(kubectl get nodes | wc -l)" -eq 2 ]; then
|
||||
kubectl taint nodes --all node-role.kubernetes.io/master-
|
||||
mode="standalone"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -168,7 +170,7 @@ function cni() {
|
||||
|
||||
function metrics() {
|
||||
METRICS_VER="${1:-$METRICS_VER}"
|
||||
METRICS_URL="https://github.com/kubernetes-incubator/metrics-server.git"
|
||||
METRICS_URL="https://github.com/kubernetes-sigs/metrics-server.git"
|
||||
METRICS_DIR="1-core-metrics"
|
||||
get_repo "${METRICS_URL}" "${METRICS_DIR}/overlays/${METRICS_VER}"
|
||||
set_repo_version "${METRICS_VER}" "${METRICS_DIR}/overlays/${METRICS_VER}/metrics-server"
|
||||
@@ -208,9 +210,9 @@ function storage() {
|
||||
ROOK_DIR=7-rook
|
||||
|
||||
# get and apply rook
|
||||
get_repo "${ROOK_URL}" "${ROOK_DIR}/overlays/${ROOK_VER}"
|
||||
set_repo_version "${ROOK_VER}" "${ROOK_DIR}/overlays/${ROOK_VER}/rook"
|
||||
kubectl apply -k "${ROOK_DIR}/overlays/${ROOK_VER}"
|
||||
get_repo "${ROOK_URL}" "${ROOK_DIR}/overlays/${ROOK_VER}/${mode}"
|
||||
set_repo_version "${ROOK_VER}" "${ROOK_DIR}/overlays/${ROOK_VER}/${mode}/rook"
|
||||
kubectl apply -k "${ROOK_DIR}/overlays/${ROOK_VER}/${mode}"
|
||||
# wait for the rook OSDs to run which means rooks should be ready
|
||||
while [[ $(kubectl get po --all-namespaces | grep -e 'osd.*Running.*' -c) -lt 1 ]]; do
|
||||
echo "Waiting for Rook OSD"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
|
||||
@@ -9,8 +8,9 @@ CLR_VER=${CLRK8S_CLR_VER:-""}
|
||||
HIGH_POD_COUNT=${HIGH_POD_COUNT:-""}
|
||||
|
||||
# set no proxy
|
||||
ADD_NO_PROXY=".svc,10.0.0.0/8,192.168.0.0/16"
|
||||
ADD_NO_PROXY+=",$(hostname -I | sed 's/[[:space:]]/,/g')"
|
||||
NO_PROXY_ARRAY=(.svc 10.0.0.0/8 )
|
||||
NO_PROXY_ARRAY+=( $(hostname -I | awk -F. '{print $1"."$2"."$3".0/24"}'))
|
||||
|
||||
if [[ -z "${RUNNER+x}" ]]; then RUNNER="${CLRK8S_RUNNER:-crio}"; fi
|
||||
|
||||
# update os version
|
||||
@@ -144,9 +144,15 @@ function ensure_system_ready() {
|
||||
# add proxy if found
|
||||
function setup_proxy() {
|
||||
set +o nounset
|
||||
set +o errexit
|
||||
if [[ ${http_proxy} ]] || [[ ${HTTP_PROXY} ]]; then
|
||||
echo "Setting up proxy stuff...."
|
||||
# Setup IP for users too
|
||||
for ip in "${NO_PROXY_ARRAY[@]}"
|
||||
do
|
||||
result=`grep no_proxy /etc/profile.d/proxy.sh | grep $ip`
|
||||
[ -z "$result" ] && ADD_NO_PROXY+="$ip,"
|
||||
done
|
||||
sed_val=${ADD_NO_PROXY//\//\\/}
|
||||
[ -f /etc/environment ] && sudo sed -i "/no_proxy/I s/$/,${sed_val}/g" /etc/environment
|
||||
if [ -f /etc/profile.d/proxy.sh ]; then
|
||||
@@ -155,19 +161,18 @@ function setup_proxy() {
|
||||
echo "Warning, failed to find /etc/profile.d/proxy.sh to edit no_proxy line"
|
||||
fi
|
||||
|
||||
services=("${RUNNER}" 'kubelet')
|
||||
for s in "${services[@]}"; do
|
||||
sudo mkdir -p "/etc/systemd/system/${s}.service.d/"
|
||||
cat <<EOF | sudo bash -c "cat > /etc/systemd/system/${s}.service.d/proxy.conf"
|
||||
[Service]
|
||||
Environment="HTTP_PROXY=${http_proxy}"
|
||||
Environment="HTTPS_PROXY=${https_proxy}"
|
||||
Environment="SOCKS_PROXY=${socks_proxy}"
|
||||
Environment="NO_PROXY=${no_proxy},${ADD_NO_PROXY}"
|
||||
cat <<EOF | sudo bash -c "cat > /usr/lib/systemd/system.conf.d/proxy.conf"
|
||||
[Manager]
|
||||
DefaultEnvironment="HTTP_PROXY=${http_proxy}"
|
||||
DefaultEnvironment="HTTPS_PROXY=${https_proxy}"
|
||||
DefaultEnvironment="SOCKS_PROXY=${socks_proxy}"
|
||||
DefaultEnvironment="NO_PROXY=${no_proxy},${ADD_NO_PROXY}"
|
||||
EOF
|
||||
done
|
||||
fi
|
||||
set -o nounset
|
||||
|
||||
sudo systemctl daemon-reexec
|
||||
fi
|
||||
set -o nounset
|
||||
set -o errexit
|
||||
}
|
||||
|
||||
# init for performing any pre tasks
|
||||
|
||||
Reference in New Issue
Block a user