Skip to content

Commit

Permalink
install CAPI components and tolerate being scheduled on master nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
cyclingwithelephants committed Dec 9, 2023
1 parent ad0514d commit 17acd7a
Show file tree
Hide file tree
Showing 16 changed files with 15,869 additions and 6 deletions.
22 changes: 16 additions & 6 deletions bootstrap/create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@ export HCLOUD_TOKEN_CCM="$(cat /Users/adam/.hetzner/cloud/projects/cloudlab-prod
export HCLOUD_TOKEN_CAPH="$(cat /Users/adam/.hetzner/cloud/projects/cloudlab-prod/tokens/capi)"

clusterctl_init() {
clusterctl init \
--core cluster-api \
--bootstrap talos \
--control-plane talos \
--infrastructure hetzner \
--wait-providers
apply_manifests_at manifests/prod/addons/cert-manager
kubectl wait --for=condition=Available --timeout=10m -n cert-manager deployment.apps/cert-manager
kubectl wait --for=condition=Available --timeout=10m -n cert-manager deployment.apps/cert-manager-cainjector
kubectl wait --for=condition=Available --timeout=10m -n cert-manager deployment.apps/cert-manager-webhook
# we apply twice to overcome a race condition between custom resources and their definitions
apply_manifests_at manifests/prod/addons/cert-manager

apply_manifests_at manifests/prod/addons/capi-system
apply_manifests_at manifests/prod/addons/cabpt-system
apply_manifests_at manifests/prod/addons/cacppt-system
apply_manifests_at manifests/prod/addons/caph-system
kubectl wait --for=condition=Available --timeout=10m -n capi-system deployment.apps/capi-controller-manager
kubectl wait --for=condition=Available --timeout=10m -n cabpt-system deployment.apps/cabpt-controller-manager
kubectl wait --for=condition=Available --timeout=10m -n cacppt-system deployment.apps/cacppt-controller-manager
kubectl wait --for=condition=Available --timeout=10m -n caph-system deployment.apps/caph-controller-manager

}

write_capi_secret() {
Expand Down
3 changes: 3 additions & 0 deletions bootstrap/destroy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ ips=$(hcloud floating-ip list | awk '{print $2 }' | awk 'NR > 1')
for ip in $ips; do
hcloud floating-ip delete $ip
done

# delete load balancer
hcloud load-balancer list | awk '{print $2 }' | awk 'NR > 1' | xargs -I {} hcloud load-balancer delete {}
9 changes: 9 additions & 0 deletions manifests/prod/addons/cabpt-system/gen-yaml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -o errexit
set -o nounset
set -o pipefail

cd "$(dirname "${BASH_SOURCE[0]}")"

clusterctl generate provider --bootstrap talos:v0.6.2 > resources/provider.yaml
17 changes: 17 additions & 0 deletions manifests/prod/addons/cabpt-system/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- resources/provider.yaml

patches:
- target:
kind: Deployment
name: cabpt-controller-manager
patch: |-
spec:
template:
spec:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
Loading

0 comments on commit 17acd7a

Please sign in to comment.