From 4db72d4962c7c55a99456fd5d138a01eafe32e08 Mon Sep 17 00:00:00 2001 From: bom Date: Fri, 6 Jan 2023 11:12:54 +0100 Subject: [PATCH] Update metallb configs to use CRDs --- .../provs/server/infrastructure/K3s.kt | 13 +++++--- .../k3s/metallb-config.dual.template.yaml | 33 ++++++++++--------- .../k3s/metallb-config.ipv4.template.yaml | 29 ++++++++-------- 3 files changed, 40 insertions(+), 35 deletions(-) diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K3s.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K3s.kt index e1f0d96..9bb158f 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K3s.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K3s.kt @@ -91,11 +91,14 @@ fun Prov.installK3s(k3sConfig: K3sConfig): ProvResult { // metallb applyK3sFileFromResource(File(k3sManualManifestsDir, "metallb-0.13.7-native-manifest.yaml")) - applyK3sFileFromResourceTemplate( - File(k3sManualManifestsDir, "metallb-config.yaml"), - k3sConfigMap, - alternativeResourceName = File(metallbConfigResourceFileName) - ) + + repeatTaskUntilSuccess(6, 10) { + applyK3sFileFromResourceTemplate( + File(k3sManualManifestsDir, "metallb-config.yaml"), + k3sConfigMap, + alternativeResourceName = File(metallbConfigResourceFileName) + ) + } // traefik if (k3sConfig.isDualStack()) { diff --git a/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/metallb-config.dual.template.yaml b/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/metallb-config.dual.template.yaml index a1e43df..563b77c 100644 --- a/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/metallb-config.dual.template.yaml +++ b/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/metallb-config.dual.template.yaml @@ -1,18 +1,19 @@ -apiVersion: v1 -kind: ConfigMap +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool metadata: + name: public namespace: metallb-system - name: config -data: - config: | - address-pools: - - name: public - protocol: layer2 - addresses: - - ${node_ipv4}/32 - - ${node_ipv6}/128 - - name: private - protocol: layer2 - addresses: - - ${loopback_ipv4}/32 - - ${loopback_ipv6}/128 \ No newline at end of file +spec: + addresses: + - ${node_ipv4}/32 + - ${node_ipv6}/128 +--- +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool +metadata: + name: private + namespace: metallb-system +spec: + addresses: + - ${loopback_ipv4}/32 + - ${loopback_ipv6}/128 \ No newline at end of file diff --git a/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/metallb-config.ipv4.template.yaml b/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/metallb-config.ipv4.template.yaml index 818bd6c..679b73c 100644 --- a/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/metallb-config.ipv4.template.yaml +++ b/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/metallb-config.ipv4.template.yaml @@ -1,16 +1,17 @@ -apiVersion: v1 -kind: ConfigMap +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool metadata: + name: public namespace: metallb-system - name: config -data: - config: | - address-pools: - - name: public - protocol: layer2 - addresses: - - ${node_ipv4}/32 - - name: private - protocol: layer2 - addresses: - - ${loopback_ipv4}/32 \ No newline at end of file +spec: + addresses: + - ${node_ipv4}/32 +--- +apiVersion: metallb.io/v1beta1 +kind: IPAddressPool +metadata: + name: private + namespace: metallb-system +spec: + addresses: + - ${loopback_ipv4}/32 \ No newline at end of file