Skip to content

Commit a01593c

Browse files
committed
feat(workflow): add haproxy
1 parent 8ce67b6 commit a01593c

2 files changed

Lines changed: 83 additions & 14 deletions

File tree

_scripts/install.sh

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,20 @@ if [[ "${INSTALL_K3S_MIRROR}" == "cn" ]] ; then
3434
mirrors:
3535
"docker.io":
3636
endpoint:
37-
- "http://hub-mirror.c.163.com"
37+
- "https://docker-mirror.drycc.cc"
3838
- "https://registry-1.docker.io"
39+
"quay.io":
40+
endpoint:
41+
- "https://quay-mirror.drycc.cc"
42+
- "https://quay.io"
43+
"gcr.io":
44+
endpoint:
45+
- "https://gcr-mirror.drycc.cc"
46+
- "https://gcr.io"
47+
"k8s.gcr.io":
48+
endpoint:
49+
- "https://k8s-mirror.drycc.cc"
50+
- "https://k8s.gcr.io"
3951
EOF
4052
k3s_install_url="http://rancher-mirror.cnrancher.com/k3s/k3s-install.sh"
4153
else
@@ -63,27 +75,22 @@ helm repo add svc-cat https://kubernetes-sigs.github.io/service-catalog
6375
helm repo add drycc https://charts.drycc.cc/${CHANNEL:-stable}
6476
helm repo update
6577

66-
helm install cilium --set operator.replicas=1 cilium/cilium --namespace kube-system
67-
helm install metallb bitnami/metallb --namespace kube-system -f - <<EOF
78+
echo -e "\\033[32m---> Waiting for helm to install components...\\033[0m"
79+
80+
helm install cilium --set operator.replicas=1 cilium/cilium --namespace kube-system --wait
81+
helm install metallb bitnami/metallb --namespace kube-system --wait -f - <<EOF
6882
configInline:
6983
address-pools:
7084
- name: default
7185
protocol: layer2
7286
addresses:
7387
- ${METALLB_ADDRESS_POOLS:-172.16.0.0/12}
7488
EOF
75-
helm install ingress-nginx ingress-nginx/ingress-nginx --namespace kube-system
76-
helm install longhorn --create-namespace --set persistence.defaultClass=false --set persistence.defaultClassReplicaCount=1 longhorn/longhorn --namespace longhorn-system
77-
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true
89+
helm install ingress-nginx ingress-nginx/ingress-nginx --namespace kube-system --wait
90+
helm install longhorn --create-namespace --set persistence.defaultClass=false --set persistence.defaultClassReplicaCount=1 longhorn/longhorn --namespace longhorn-system --wait
91+
helm install cert-manager jetstack/cert-manager --namespace cert-manager --create-namespace --set installCRDs=true --wait
7892
helm install catalog svc-cat/catalog --set asyncBindingOperationsEnabled=true --namespace catalog --create-namespace --wait
7993

80-
echo -e "\\033[32m---> Waiting cert-manager...\\033[0m"
81-
while [ $(kubectl get pods -n cert-manager|grep Running|wc -l) -le 2 ]
82-
do
83-
kubectl get pods -n cert-manager
84-
sleep 10
85-
done
86-
8794
echo -e "\\033[32m---> Start installing workflow...\\033[0m"
8895

8996
RABBITMQ_USERNAME=$(cat /proc/sys/kernel/random/uuid)
@@ -147,6 +154,49 @@ spec:
147154
url: http://${HELMBROKER_USERNAME}:${HELMBROKER_PASSWORD}@drycc-helmbroker.${PLATFORM_DOMAIN}
148155
EOF
149156

157+
BUILDER_IP=$(kubectl get svc drycc-builder -n drycc -o="jsonpath={.status.loadBalancer.ingress[0].ip}")
158+
INGRESS_IP=$(kubectl get svc ingress-nginx-controller -n kube-system -o="jsonpath={.status.loadBalancer.ingress[0].ip}")
159+
160+
if [[ "${USE_HAPROXY:-true}" == "true" ]] ; then
161+
cat << EOF > "/etc/haproxy/haproxy.cfg"
162+
global
163+
log /dev/log local0
164+
log /dev/log local1 notice
165+
chroot /var/lib/haproxy
166+
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
167+
stats timeout 30s
168+
user haproxy
169+
group haproxy
170+
daemon
171+
listen http-80
172+
bind *:80
173+
mode tcp
174+
maxconn 100000
175+
timeout connect 60s
176+
timeout client 30000
177+
timeout server 30000
178+
server ingress ${INGRESS_IP}:80 check
179+
listen http-443
180+
bind *:443
181+
mode tcp
182+
maxconn 100000
183+
timeout connect 60s
184+
timeout client 30000
185+
timeout server 30000
186+
server ingress ${INGRESS_IP}:443 check
187+
listen builder
188+
bind *:2222
189+
mode tcp
190+
maxconn 100000
191+
timeout connect 60s
192+
timeout client 30000
193+
timeout server 30000
194+
server builder ${BUILDER_IP}:2222 check
195+
EOF
196+
fi
197+
systemctl enable haproxy
198+
systemctl restart haproxy
199+
150200
echo -e "\\033[32m---> Please save the following information for future use.\\033[0m"
151201
echo -e "\\033[32m---> Rabbitmq username: $RABBITMQ_USERNAME\\033[0m"
152202
echo -e "\\033[32m---> Rabbitmq password: $RABBITMQ_PASSWORD\\033[0m"

src/quickstart/install-workflow.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,24 @@ For RHEL, CentOS, and EKS with EKS Kubernetes Worker AMI with AmazonLinux2 image
5555
$ yum install nfs-utils
5656
```
5757

58+
### Installing haproxy
59+
We use metallb as the loadblance component.
60+
If the host managed by metallb has a public IP, we don't need to install haproxy.
61+
Otherwise, we need to use haproxy to expose ports such as `80` and `443 `.
62+
Ensure that ports `80`, `443` and `2222` cannot be occupied by other applications on the host, and focus on services such as httpd and nginx.
63+
64+
For Debian and Ubuntu, use this command:
65+
66+
```
67+
$ apt-get install haproxy
68+
```
69+
70+
For RHEL, CentOS, and EKS with EKS Kubernetes Worker AMI with AmazonLinux2 image, use this command:
71+
72+
```
73+
$ yum install haproxy
74+
```
75+
5876
### Installing curl
5977

6078
For Debian and Ubuntu, use this command:
@@ -124,7 +142,8 @@ PLATFORM_DOMAIN | Required item, specify drycc's domain name
124142
DRYCC_ADMIN_USERNAME | Required item, specify drycc's admin username
125143
DRYCC_ADMIN_PASSWORD | Required item, specify drycc's admin password
126144
CHANNEL | By default, `stable` channel will be installed. You can also specify `testing`
127-
METALLB_ADDRESS_POOLS | IP pool for LoadBalancer, it can be a public IP pool. The default is `172.16.0.0/12`
145+
USE_HAPROXY | Haproxy is enabled by default. If you want to turn it off, this value is false
146+
METALLB_ADDRESS_POOLS | IP pool for LoadBalancer. The default is `172.16.0.0/12`
128147
INSTALL_K3S_MIRROR | Specify the accelerated mirror location. Currently, only `cn` is supported
129148
MINIO_PERSISTENCE_SIZE | The size of the persistence space allocated to `minio`, which is `5Gi` by default
130149
MONITOR_PERSISTENCE_SIZE | The size of the persistence space allocated to `monitor`, which is `5Gi` by default

0 commit comments

Comments
 (0)