Adopt networking catalogues to Treasuremap

This adds network deduplication via variable catalogues and replacement.
This was added to airshipctl under the change:
https://review.opendev.org/#/c/749611/

Change-Id: Ib6a50c58e3b62de4f74c5def58b94ab6dbd1e949
Closes: https://github.com/airshipit/airshipctl/issues/315
This commit is contained in:
Matt McEuen 2020-09-17 13:29:02 -05:00 committed by Drew Walters
parent aa05b04133
commit c4d185bba6
39 changed files with 198 additions and 63 deletions

View File

@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../../../../airshipctl/manifests/function/hostgenerator-m3 - ../../../../../../../airshipctl/manifests/function/hostgenerator-m3
- ../../../shared/catalogues/ - ../../catalogues/
- host-generation.yaml - host-generation.yaml
transformers: transformers:

View File

@ -2,9 +2,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../type/airship-core/ephemeral/bootstrap - ../../../../type/airship-core/ephemeral/bootstrap
- ../catalogues
generators: generators:
- hostgenerator - hostgenerator
patchesStrategicMerge: patchesStrategicMerge:
- baremetalhost.yaml - baremetalhost.yaml
transformers:
- ../../../../type/airship-core/ephemeral/bootstrap/replacements

View File

@ -0,0 +1,4 @@
# Catalogue Definitions for Target Cluster
This inherits Site-level catalogues from the neighboring target cluster's
`catalogues` kustomization, and tweaks a few values for the ephemeral cluster.

View File

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../target/catalogues
patchesStrategicMerge:
- networking.yaml

View File

@ -0,0 +1,19 @@
# This makes a couple small networking tweaks that are specific to the
# ephemeral cluster, on top of the target cluster networking definition.
# These values can be overridden at the site, type, etc levels as appropriate.
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: networking
# The catalogue should be overridden as appropriate for different kubernetes
# clusters, e.g. ephemeral vs target vs tenant
kubernetes:
podCidr: "192.168.0.0/24"
controlPlaneEndpoint:
host: "10.23.25.101"
apiserverCertSANs: "[10.23.25.101, 10.23.24.101]"
ironic:
provisioningIp: "10.23.24.101"
dhcpRange: "10.23.24.200,10.23.24.250"

View File

@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../../../../airshipctl/manifests/function/hostgenerator-m3 - ../../../../../../../airshipctl/manifests/function/hostgenerator-m3
- ../../../shared/catalogues/ - ../../catalogues/
- host-generation.yaml - host-generation.yaml
transformers: transformers:

View File

@ -2,11 +2,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../type/airship-core/ephemeral/controlplane - ../../../../type/airship-core/ephemeral/controlplane
- ../../shared/catalogues - ../catalogues
# TODO (dukov) It's recocommended to upload BareMetalHost objects separately # TODO (dukov) It's recocommended to upload BareMetalHost objects separately
# otherwise nodes will hang in 'registering' state for quite a long time # otherwise nodes will hang in 'registering' state for quite a long time
- nodes - nodes
patchesStrategicMerge:
- versions-catalogue-patch.yaml
transformers: transformers:
- ../../../../type/airship-core/ephemeral/controlplane/replacements - ../../../../type/airship-core/ephemeral/controlplane/replacements

View File

@ -1,7 +1,5 @@
resources: resources:
- ../../../../type/airship-core/ephemeral/initinfra - ../../../../type/airship-core/ephemeral/initinfra
- ../../shared/catalogues - ../catalogues
patchesStrategicMerge:
- patch_bmo_config.yaml
transformers: transformers:
- ../../../../type/airship-core/ephemeral/initinfra/replacements - ../../../../type/airship-core/ephemeral/initinfra/replacements

View File

@ -1,8 +0,0 @@
---
kind: ConfigMap
apiVersion: v1
metadata:
name: ironic-vars
data:
PROVISIONING_IP: "10.23.24.101"
DHCP_RANGE: "10.23.24.200,10.23.24.250"

View File

@ -0,0 +1,5 @@
# Catalogue Definitions for Target Cluster
This inherits Type-level catalogues, and adds in Site-specific values.
The neighboring ephemeral cluster's `catalogues` entrypoint applies further
customizations on top of this for ephemeral use.

View File

@ -3,12 +3,14 @@
apiVersion: airshipit.org/v1alpha1 apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue kind: VariableCatalogue
metadata: metadata:
name: host-catalogue
labels: labels:
airshipit.org/deploy-k8s: "false" airshipit.org/deploy-k8s: "false"
name: host-catalogue
hosts: hosts:
m3: m3:
node01: node01:
bootMode: UEFI
macAddress: 52:54:00:b6:ed:31 macAddress: 52:54:00:b6:ed:31
bmcAddress: redfish+http://10.23.25.1:8000/redfish/v1/Systems/air-target-1 bmcAddress: redfish+http://10.23.25.1:8000/redfish/v1/Systems/air-target-1
bmcUsername: root bmcUsername: root
@ -19,9 +21,9 @@ hosts:
macAddresses: macAddresses:
oam: 52:54:00:9b:27:4c oam: 52:54:00:9b:27:4c
pxe: 52:54:00:b6:ed:31 pxe: 52:54:00:b6:ed:31
bootMode: legacy hardwareProfile: default # defined in the hostgenerator-m3 function
hardwareProfile: default # defined in the hostgenerator-m3 function
node02: node02:
bootMode: UEFI
macAddress: 52:54:00:b6:ed:02 macAddress: 52:54:00:b6:ed:02
bmcAddress: redfish+http://10.23.25.2:8000/redfish/v1/Systems/air-target-2 bmcAddress: redfish+http://10.23.25.2:8000/redfish/v1/Systems/air-target-2
bmcUsername: username bmcUsername: username
@ -32,4 +34,17 @@ hosts:
macAddresses: macAddresses:
oam: 52:54:00:9b:27:02 oam: 52:54:00:9b:27:02
pxe: 52:54:00:b6:ed:02 pxe: 52:54:00:b6:ed:02
hardwareProfile: default # defined in the hostgenerator-m3 function hardwareProfile: example # defined in the hardwareprofile-example function
node03:
bootMode: UEFI
macAddress: 52:54:00:b6:ed:23
bmcAddress: redfish+http://10.23.25.1:8000/redfish/v1/Systems/air-worker-1
bmcUsername: username
bmcPassword: password
ipAddresses:
oam-ipv4: 10.23.25.103
pxe-ipv4: 10.23.24.103
macAddresses:
oam: 52:54:00:9b:27:07
pxe: 52:54:00:b6:ed:23
hardwareProfile: default # defined in the hardwareprofile-example function

View File

@ -1,5 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../type/airship-core/shared/catalogues - ../../../../type/airship-core/shared/catalogues
- hosts.yaml - hosts.yaml
patchesStrategicMerge:
- versions-airshipctl.yaml
- networking.yaml

View File

@ -0,0 +1,19 @@
# This makes a couple small networking tweaks that are specific to the
# ephemeral cluster, on top of the target cluster networking definition.
# These values can be overridden at the site, type, etc levels as appropriate.
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: networking
# The catalogue should be overridden as appropriate for different kubernetes
# clusters, e.g. ephemeral vs target vs tenant
kubernetes:
controlPlaneEndpoint:
host: "10.23.25.102"
apiserverCertSANs: "[10.23.25.102, 10.23.24.102]"
ironic:
provisioningIp: "10.23.24.102"
dhcpRange: "10.23.24.200,10.23.24.250"

View File

@ -1,11 +1,12 @@
# Patch the versions catalogue to use the site-specific local image URL # Override default controlplane image location
# TODO: patch this in from a site-networking catalogue in the future
apiVersion: airshipit.org/v1alpha1 apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue kind: VariableCatalogue
metadata: metadata:
name: versions-airshipctl name: versions-airshipctl
files: files:
k8scontrol: k8scontrol:
# Host the image in a locally served location for CI
cluster_controlplane_image: cluster_controlplane_image:
url: http://10.23.24.1:8099/target-image.qcow2 url: http://10.23.24.1:8099/target-image.qcow2
checksum: http://10.23.24.1:8099/target-image.qcow2.md5sum checksum: http://10.23.24.1:8099/target-image.qcow2.md5sum

View File

@ -1,8 +1,6 @@
resources: resources:
- ../../../../type/airship-core/target/initinfra - ../../../../type/airship-core/target/initinfra
- ../../shared/catalogues
- ../../../../function/hostconfig-operator - ../../../../function/hostconfig-operator
patchesStrategicMerge: - ../catalogues
- patch_bmo_config.yaml
transformers: transformers:
- ../../../../type/airship-core/target/initinfra/replacements - ../../../../type/airship-core/target/initinfra/replacements

View File

@ -1,8 +0,0 @@
---
kind: ConfigMap
apiVersion: v1
metadata:
name: ironic-vars
data:
PROVISIONING_IP: "10.23.25.102"
DHCP_RANGE: "10.23.25.200,10.23.25.250"

View File

@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../../../../airshipctl/manifests/function/hostgenerator-m3 - ../../../../../../../airshipctl/manifests/function/hostgenerator-m3
- ../../../shared/catalogues/ - ../../catalogues/
- host-generation.yaml - host-generation.yaml
transformers: transformers:

View File

@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../../../../airshipctl/manifests/function/hostgenerator-m3 - ../../../../../../../airshipctl/manifests/function/hostgenerator-m3
- ../../../shared/catalogues/ - ../../catalogues/
- host-generation.yaml - host-generation.yaml
transformers: transformers:

View File

@ -2,9 +2,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../type/network-cloud/ephemeral/bootstrap - ../../../../type/network-cloud/ephemeral/bootstrap
- ../catalogues
generators: generators:
- hostgenerator - hostgenerator
patchesStrategicMerge: patchesStrategicMerge:
- baremetalhost.yaml - baremetalhost.yaml
transformers:
- ../../../../type/network-cloud/ephemeral/bootstrap/replacements

View File

@ -0,0 +1,4 @@
# Catalogue Definitions for Target Cluster
This inherits Site-level catalogues from the neighboring target cluster's
`catalogues` kustomization, and tweaks a few values for the ephemeral cluster.

View File

@ -0,0 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../target/catalogues
patchesStrategicMerge:
- networking.yaml

View File

@ -0,0 +1,20 @@
# This makes a couple small networking tweaks that are specific to the
# ephemeral cluster, on top of the target cluster networking definition.
# These values can be overridden at the site, type, etc levels as appropriate.
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: networking-catalogue
# The catalogue should be overridden as appropriate for different kubernetes
# clusters, e.g. ephemeral vs target vs tenant
kubernetes:
podCidr: "192.168.0.0/24"
controlPlaneEndpoint:
host: "10.23.25.101"
apiserverCertSANs: "[10.23.25.101, 10.23.24.101]"
ironic:
provisioningIp: "10.23.24.101"
dhcpRange: "10.23.24.200,10.23.24.250"

View File

@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../../../../airshipctl/manifests/function/hostgenerator-m3 - ../../../../../../../airshipctl/manifests/function/hostgenerator-m3
- ../../../shared/catalogues/ - ../../catalogues/
- host-generation.yaml - host-generation.yaml
transformers: transformers:

View File

@ -2,11 +2,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../type/network-cloud/ephemeral/controlplane - ../../../../type/network-cloud/ephemeral/controlplane
- ../../shared/catalogues - ../catalogues
# TODO (dukov) It's recocommended to upload BareMetalHost objects separately # TODO (dukov) It's recocommended to upload BareMetalHost objects separately
# otherwise nodes will hang in 'registering' state for quite a long time # otherwise nodes will hang in 'registering' state for quite a long time
- nodes - nodes
patchesStrategicMerge:
- versions-catalogue-patch.yaml
transformers: transformers:
- ../../../../type/network-cloud/ephemeral/controlplane/replacements - ../../../../type/network-cloud/ephemeral/controlplane/replacements

View File

@ -1,7 +1,5 @@
resources: resources:
- ../../../../type/network-cloud/ephemeral/initinfra - ../../../../type/network-cloud/ephemeral/initinfra
- ../../shared/catalogues - ../catalogues
patchesStrategicMerge:
- patch_bmo_config.yaml
transformers: transformers:
- ../../../../type/airship-core/ephemeral/initinfra/replacements - ../../../../type/airship-core/ephemeral/initinfra/replacements

View File

@ -1,9 +0,0 @@
---
kind: ConfigMap
apiVersion: v1
metadata:
labels:
name: ironic-vars
data:
PROVISIONING_IP: "10.23.24.101"
DHCP_RANGE: "10.23.24.200,10.23.24.250"

View File

@ -0,0 +1,5 @@
# Catalogue Definitions for Target Cluster
This inherits Type-level catalogues, and adds in Site-specific values.
The neighboring ephemeral cluster's `catalogues` entrypoint applies further
customizations on top of this for ephemeral use.

View File

@ -3,9 +3,10 @@
apiVersion: airshipit.org/v1alpha1 apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue kind: VariableCatalogue
metadata: metadata:
name: host-catalogue
labels: labels:
airshipit.org/deploy-k8s: "false" airshipit.org/deploy-k8s: "false"
name: host-catalogue
hosts: hosts:
m3: m3:
node01: node01:

View File

@ -1,5 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../type/network-cloud/shared/catalogues - ../../../../type/network-cloud/shared/catalogues
- hosts.yaml - hosts.yaml
patchesStrategicMerge:
- versions-airshipctl.yaml
- networking.yaml

View File

@ -0,0 +1,19 @@
# This makes a couple small networking tweaks that are specific to the
# ephemeral cluster, on top of the target cluster networking definition.
# These values can be overridden at the site, type, etc levels as appropriate.
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: networking-catalogue
# The catalogue should be overridden as appropriate for different kubernetes
# clusters, e.g. ephemeral vs target vs tenant
kubernetes:
controlPlaneEndpoint:
host: "10.23.25.102"
apiserverCertSANs: "[10.23.25.102, 10.23.24.102]"
ironic:
provisioningIp: "10.23.24.102"
dhcpRange: "10.23.24.200,10.23.24.250"

View File

@ -0,0 +1,12 @@
# Override default controlplane image location
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
metadata:
name: versions-airshipctl
files:
k8scontrol:
# Host the image in a locally served location for CI
cluster_controlplane_image:
url: http://10.23.24.1:8099/target-image.qcow2
checksum: http://10.23.24.1:8099/target-image.qcow2.md5sum

View File

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

View File

@ -1,2 +1,3 @@
resources: resources:
- ../../../../../../../airshipctl/manifests/function/baremetal-operator/replacements - ../../../../../../../airshipctl/manifests/function/baremetal-operator/replacements
- ../../../../../../../airshipctl/manifests/composite/infra/replacements

View File

@ -1,8 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- ../../../../../../airshipctl/manifests/function/airshipctl-catalogues/ - ../../../../../../airshipctl/manifests/function/airshipctl-base-catalogues
- common-networking.yaml patchesStrategicMerge:
- networking.yaml
# Uncomment to patch versions catalogue once needed # Uncomment to patch versions catalogue once needed
# patchesStrategicMerge: # patchesStrategicMerge:
# - versions.yaml # - versions.yaml

View File

@ -1,12 +1,17 @@
# Type-level networking catalogue. This info feeds the Templater # The default networking catalogue for functions hosted in the airshipctl project.
# kustomize plugin config in the hostgenerator-m3 function. # These values can be overridden at the site, type, etc levels as appropriate.
apiVersion: airshipit.org/v1alpha1 apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue kind: VariableCatalogue
metadata: metadata:
labels: labels:
airshipit.org/deploy-k8s: "false" airshipit.org/deploy-k8s: "false"
name: common-networking-catalogue name: networking
commonNetworking:
# This section is only relevant when using Metal3 BareMetalHosts, and
# is consumed by the `hostgenerator-m3` function.
# It defines host-level networking that is common across all BMHs in a site,
# and will typically be fully overridden at the Type and Site level.
commonHostNetworking:
links: links:
- id: oam - id: oam
name: oam name: oam
@ -38,4 +43,3 @@ commonNetworking:
type: dns type: dns
- address: 8.8.4.4 - address: 8.8.4.4
type: dns type: dns

View File

@ -1,2 +1,4 @@
resources: resources:
- ../../../../../../../airshipctl/manifests/function/baremetal-operator/replacements - ../../../../../../../airshipctl/manifests/function/baremetal-operator/replacements
- ../../../../../../../airshipctl/manifests/function/helm-operator/replacements
- ../../../../../../../airshipctl/manifests/composite/infra/replacements

View File

@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../../../../airship-core/ephemeral/bootstrap/replacements

View File

@ -3,7 +3,7 @@ kind: Kustomization
resources: resources:
- ../../../airship-core/shared/catalogues - ../../../airship-core/shared/catalogues
# NOTE(drewwalters96): Uncomment to patch common-networking catalogue. # NOTE(drewwalters96): Uncomment to patch networking catalogue.
# patchesStrategicMerge: # patchesStrategicMerge:
# - common-networking.yaml # - common-networking.yaml
# Uncomment to patch versions catalogue once needed # Uncomment to patch versions catalogue once needed