Support for VRRP keepalived for Ingress

- Added function/k8scontrol-ha
- Updated type/airship-core/controlplane to point to treasuremap
  function
- added networking-ha VariableCatalogue to treasuremap-base-catlg
Issue #94

Change-Id: I5a1ea545a01f59cd2213c375e42dcbca34bbad22
This commit is contained in:
Manoj Alva(ma257n) 2021-03-05 14:49:08 +00:00
parent 5ae31997b2
commit 5ef460d926
16 changed files with 162 additions and 3 deletions

View File

@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../airshipctl/manifests/function/k8scontrol
patchesJson6902:
- target:
group: controlplane.cluster.x-k8s.io
version: v1alpha3
kind: KubeadmControlPlane
name: cluster-controlplane
path: vrrp_keepalived_patch.yaml

View File

@ -0,0 +1,2 @@
resources:
- networking-ha.yaml

View File

@ -0,0 +1,49 @@
apiVersion: airshipit.org/v1alpha1
kind: ReplacementTransformer
metadata:
name: networking-ha-replacements
annotations:
config.kubernetes.io/function: |-
container:
image: quay.io/airshipit/replacement-transformer:latest
replacements:
- source:
objref:
kind: VariableCatalogue
name: networking-ha
fieldref: vrrp.kubernetes.virtual_ipaddress
target:
objref:
kind: KubeadmControlPlane
fieldrefs:
- "spec.kubeadmConfigSpec.files[path=/etc/keepalived/keepalived.conf].content%REPLACEMENT_VIP_1%"
- source:
objref:
kind: VariableCatalogue
name: networking-ha
fieldref: vrrp.ingress.virtual_ipaddress
target:
objref:
kind: KubeadmControlPlane
fieldrefs:
- "spec.kubeadmConfigSpec.files[path=/etc/keepalived/keepalived.conf].content%REPLACEMENT_VIP_2%"
- source:
objref:
kind: VariableCatalogue
name: networking-ha
fieldref: vrrp.kubernetes.interface
target:
objref:
kind: KubeadmControlPlane
fieldrefs:
- "spec.kubeadmConfigSpec.files[path=/etc/keepalived/keepalived.conf].content%REPLACEMENT_INTERFACE_1%"
- source:
objref:
kind: VariableCatalogue
name: networking-ha
fieldref: vrrp.ingress.interface
target:
objref:
kind: KubeadmControlPlane
fieldrefs:
- "spec.kubeadmConfigSpec.files[path=/etc/keepalived/keepalived.conf].content%REPLACEMENT_INTERFACE_2%"

View File

@ -0,0 +1,33 @@
- op: add
path: "/spec/kubeadmConfigSpec/files/-"
value:
path: /etc/keepalived/keepalived.conf
content: |
! Configuration File for keepalived
global_defs {
}
vrrp_instance KUBERNETES {
state BACKUP
interface REPLACEMENT_INTERFACE_1
virtual_router_id 101
priority 101
advert_int 1
virtual_ipaddress {
REPLACEMENT_VIP_1
}
}
vrrp_instance INGRESS {
state BACKUP
interface REPLACEMENT_INTERFACE_2
virtual_router_id 102
priority 102
advert_int 1
virtual_ipaddress {
REPLACEMENT_VIP_2
}
}
- op: add
path: "/spec/kubeadmConfigSpec/preKubeadmCommands/-"
value:
apt-get update && apt-get install -y bridge-utils keepalived ipset ipvsadm
systemctl enable --now keepalived

View File

@ -1,2 +1,3 @@
resources: resources:
- versions-treasuremap.yaml - versions-treasuremap.yaml
- networking-ha.yaml

View File

@ -0,0 +1,15 @@
# This catalogue alone needs to be overriden at site level based on the
# networkign requirement like HA
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: networking-ha
labels:
airshipit.org/deploy-k8s: "false"
vrrp:
kubernetes:
interface: bond.51
virtual_ipaddress: 10.23.25.101
ingress:
interface: bond.51
virtual_ipaddress: 10.23.25.102

View File

@ -33,3 +33,9 @@ patches: |-
metadata: metadata:
name: versions-treasuremap name: versions-treasuremap
$patch: delete $patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: networking-ha
$patch: delete

View File

@ -33,3 +33,9 @@ patches: |-
metadata: metadata:
name: versions-treasuremap name: versions-treasuremap
$patch: delete $patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: networking-ha
$patch: delete

View File

@ -9,3 +9,4 @@ resources:
patchesStrategicMerge: patchesStrategicMerge:
- versions-airshipctl.yaml - versions-airshipctl.yaml
- networking.yaml - networking.yaml
- networking-ha.yaml

View File

@ -0,0 +1,15 @@
# This catalogue alone needs to be overriden at site level based on the
# networkign requirement like HA
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: networking-ha
labels:
airshipit.org/deploy-k8s: "false"
vrrp:
kubernetes:
interface: bond.41
virtual_ipaddress: 10.23.25.103
ingress:
interface: bond.41
virtual_ipaddress: 10.23.25.104

View File

@ -13,7 +13,6 @@ spec:
controlPlaneEndpoint: controlPlaneEndpoint:
host: "10.23.25.102" host: "10.23.25.102"
apiserverCertSANs: "[10.23.25.102, 10.23.24.102]" apiserverCertSANs: "[10.23.25.102, 10.23.24.102]"
ironic: ironic:
provisioningIp: "10.23.24.102" provisioningIp: "10.23.24.102"
dhcpRange: "10.23.24.200,10.23.24.250" dhcpRange: "10.23.24.200,10.23.24.250"

View File

@ -33,3 +33,9 @@ patches: |-
metadata: metadata:
name: versions-treasuremap name: versions-treasuremap
$patch: delete $patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: networking-ha
$patch: delete

View File

@ -39,3 +39,9 @@ patches: |-
metadata: metadata:
name: versions-treasuremap name: versions-treasuremap
$patch: delete $patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: networking-ha
$patch: delete

View File

@ -33,3 +33,9 @@ patches: |-
metadata: metadata:
name: versions-treasuremap name: versions-treasuremap
$patch: delete $patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: networking-ha
$patch: delete

View File

@ -1,7 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../../../airshipctl/manifests/function/k8scontrol - ../../../../function/k8scontrol-ha
- dex-apiserver/apiserver-certs-secret.yaml - dex-apiserver/apiserver-certs-secret.yaml
patchesJson6902: patchesJson6902:

View File

@ -1,4 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../../function/k8scontrol-ha/replacements
- ../../../../../../../airshipctl/manifests/function/k8scontrol/replacements - ../../../../../../../airshipctl/manifests/function/k8scontrol/replacements