Skip to content

Commit bdfa491

Browse files
authored
Merge pull request #49 from TykTechnologies/fix/resillience-improvements
[TT-15770]: Integrate cloud-provider-kind and remove nginx manifests
2 parents 7e3711e + 34268d6 commit bdfa491

File tree

7 files changed

+266
-793
lines changed

7 files changed

+266
-793
lines changed

k8s/tyk-stack-ingress/control-plane-values.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ tyk-gateway:
399399
enabled: true
400400

401401
# specify ingress controller class name
402-
className: ""
402+
className: "nginx"
403403

404404
# annotations for ingress
405405
annotations: {}
@@ -1404,7 +1404,7 @@ tyk-dashboard:
14041404
ingress:
14051405
enabled: true
14061406
# specify your ingress controller class name below
1407-
className: ""
1407+
className: "nginx"
14081408
annotations: {}
14091409
# kubernetes.io/ingress.class: nginx
14101410
# kubernetes.io/tls-acme: "true"
@@ -1629,7 +1629,7 @@ tyk-mdcb:
16291629
http_ingress:
16301630
enabled: true
16311631
# className specifies your ingress controller class name below
1632-
className: ""
1632+
className: "nginx"
16331633
# annotations specifies annotations to be added on Ingress resource.
16341634
annotations: {}
16351635
# kubernetes.io/ingress.class: nginx

k8s/tyk-stack-ingress/create-cluster.sh

Lines changed: 58 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,34 @@
1-
cat <<EOF | kind create cluster --config=-
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
cd "$(dirname "$0")"
6+
7+
source lib.sh
8+
9+
KIND_NETWORK_NAME=${KIND_NETWORK_NAME:-kind}
10+
KIND_CLOUD_PROVIDER_KIND_VERSION="v0.7.0"
11+
12+
function check_dependencies() {
13+
for cmd in kind docker; do
14+
if ! command -v "$cmd" > /dev/null 2>&1; then
15+
error "$cmd is not installed or not in PATH"
16+
exit 1
17+
fi
18+
done
19+
}
20+
21+
function create_kind_cluster() {
22+
local cluster_name=${1:-kind}
23+
24+
if kind get clusters | grep -q "^${cluster_name}$"; then
25+
log "Kind cluster '$cluster_name' already exists. Skipping creation."
26+
return 0
27+
fi
28+
29+
log "Creating kind cluster '$cluster_name'"
30+
31+
cat << EOF | kind create cluster --name="$cluster_name" --config=-
232
kind: Cluster
333
apiVersion: kind.x-k8s.io/v1alpha4
434
nodes:
@@ -16,4 +46,30 @@ nodes:
1646
- containerPort: 443
1747
hostPort: 443
1848
protocol: TCP
19-
EOF
49+
EOF
50+
}
51+
52+
function run_cloud_provider_kind() {
53+
local container_name="tyk-ci-cloud-provider-kind"
54+
55+
if docker ps --format "{{.Names}}" | grep -q "$container_name"; then
56+
log "container '$container_name' is already running. recreating it"
57+
58+
docker rm -f "$container_name"
59+
sleep 2
60+
fi
61+
62+
log "running container '$container_name' for cloud-provider-kind/cloud-controller-manager image"
63+
64+
docker run --network "$KIND_NETWORK_NAME" \
65+
--name "$container_name" \
66+
--detach \
67+
-v /var/run/docker.sock:/var/run/docker.sock \
68+
registry.k8s.io/cloud-provider-kind/cloud-controller-manager:"${KIND_CLOUD_PROVIDER_KIND_VERSION}" -enable-lb-port-mapping
69+
}
70+
71+
check_dependencies
72+
create_kind_cluster
73+
run_cloud_provider_kind
74+
75+
log "--> $0 done"

k8s/tyk-stack-ingress/data-plane-values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ tyk-gateway:
357357
enabled: true
358358

359359
# specify ingress controller class name
360-
className: ""
360+
className: "nginx"
361361

362362
# annotations for ingress
363363
annotations: {}

k8s/tyk-stack-ingress/lib.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/usr/bin/env bash
2+
3+
set -o monitor
4+
5+
GREEN='\033[0;32m'
6+
RED='\033[0;31m'
7+
ORANGE='\033[0;33m'
8+
NC='\033[0m'
9+
10+
log() {
11+
echo -e "${GREEN}[INFO]${NC} $@"
12+
}
13+
14+
warning() {
15+
echo -e "${ORANGE}[WARNING]${NC} $@"
16+
}
17+
18+
error() {
19+
echo -e "${RED}[ERROR]${NC} $@"
20+
}

0 commit comments

Comments
 (0)