Merge "Create NetworkCatalogue structural schema CRD"

This commit is contained in:
Zuul 2021-02-27 00:46:49 +00:00 committed by Gerrit Code Review
commit 0c651e3b4d
12 changed files with 260 additions and 140 deletions

View File

@ -1,62 +1,62 @@
# The default networking catalogue for functions hosted in the airshipctl project.
# These values can be overridden at the site, type, etc levels as appropriate.
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
kind: NetworkCatalogue
metadata:
name: networking
labels:
airshipit.org/deploy-k8s: "false"
spec:
# The catalogue should be overridden as appropriate for different kubernetes
# clusters, e.g. ephemeral vs target vs tenant
kubernetes:
serviceCidr: "10.96.0.0/12"
podCidr: "192.168.0.0/18"
controlPlaneEndpoint:
host: "10.23.25.102" # ephemeral will be different
port: 6443
# NOTE: This stringing is required to do substring replacement.
# Ideally, improve this in the future.
apiserverCertSANs: "[10.23.25.201, 10.23.24.201]"
# The catalogue should be overridden as appropriate for different kubernetes
# clusters, e.g. ephemeral vs target vs tenant
kubernetes:
serviceCidr: "10.96.0.0/12"
podCidr: "192.168.0.0/18"
controlPlaneEndpoint:
host: "10.23.25.102" # ephemeral will be different
port: 6443
# NOTE: This stringing is required to do substring replacement.
# Ideally, improve this in the future.
apiserverCertSANs: "[10.23.25.201, 10.23.24.201]"
ironic:
provisioningInterface: "pxe"
provisioningIp: "10.23.25.102"
dhcpRange: "10.23.25.200,10.23.25.250"
ironic:
provisioningInterface: "pxe"
provisioningIp: "10.23.25.102"
dhcpRange: "10.23.25.200,10.23.25.250"
# 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:
- id: oam
name: oam
type: phy
mtu: "1500"
# ethernet_mac_address: <from host-catalogue> (optional)
- id: pxe
name: pxe
type: phy
mtu: "1500"
# ethernet_mac_address: <from host-catalogue> (optional)
networks:
- id: oam-ipv4
type: ipv4
link: oam
# ip_address: <from host-catalogue>
netmask: 255.255.255.0
routes:
- network: 0.0.0.0
netmask: 0.0.0.0
gateway: 10.23.25.1
- id: pxe-ipv4
type: ipv4
link: pxe
# ip_address: <from host-catalogue>
netmask: 255.255.255.0
services:
- address: 8.8.8.8
type: dns
- address: 8.8.4.4
type: dns
# 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:
- id: oam
name: oam
type: phy
mtu: "1500"
# ethernet_mac_address: <from host-catalogue> (optional)
- id: pxe
name: pxe
type: phy
mtu: "1500"
# ethernet_mac_address: <from host-catalogue> (optional)
networks:
- id: oam-ipv4
type: ipv4
link: oam
# ip_address: <from host-catalogue>
netmask: 255.255.255.0
routes:
- network: 0.0.0.0
netmask: 0.0.0.0
gateway: 10.23.25.1
- id: pxe-ipv4
type: ipv4
link: pxe
# ip_address: <from host-catalogue>
netmask: 255.255.255.0
services:
- address: 8.8.8.8
type: dns
- address: 8.8.4.4
type: dns

View File

@ -1,2 +1,3 @@
resources:
- versions-catalogue.yaml
- network-catalogue.yaml

View File

@ -0,0 +1,121 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: networkcatalogues.airshipit.org
spec:
group: airshipit.org
names:
kind: NetworkCatalogue
plural: networkcatalogues
singular: networkcatalogue
scope: Namespaced
versions:
- name: v1alpha1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
commonHostNetworking:
type: object
properties:
links:
type: array
items:
type: object
properties:
id:
type: string
name:
type: string
type:
type: string
mtu:
type: string
networks:
type: array
items:
type: object
properties:
id:
type: string
type:
type: string
link:
type: string
netmask:
type: string
oneOf:
- format: ipv4
- format: ipv6
routes:
type: array
items:
type: object
properties:
network:
type: string
oneOf:
- format: ipv4
- format: ipv6
netmask:
type: string
oneOf:
- format: ipv4
- format: ipv6
gateway:
type: string
oneOf:
- format: ipv4
- format: ipv6
services:
type: array
items:
type: object
properties:
address:
type: string
oneOf:
- format: ipv4
- format: ipv6
type:
type: string
kubernetes:
type: object
properties:
serviceCidr:
type: string
format: cidr
podCidr:
type: string
format: cidr
controlPlaneEndpoint:
type: object
properties:
host:
type: string
oneOf:
- format: ipv4
- format: ipv6
port:
type: integer
maximum: 65535
apiserverCertSANs:
type: string
ironic:
type: object
properties:
provisioningInterface:
type: string
provisioningIp:
type: string
oneOf:
- format: ipv4
- format: ipv6
dhcpRange:
# TODO(mfuller): should this be enforced with a pattern?
type: string

View File

@ -11,9 +11,9 @@ replacements:
# Replace the pod & service networks
- source:
objref:
kind: VariableCatalogue
kind: NetworkCatalogue
name: networking
fieldref: ironic.provisioningInterface
fieldref: spec.ironic.provisioningInterface
target:
objref:
kind: ConfigMap
@ -21,9 +21,9 @@ replacements:
fieldrefs: ["data.PROVISIONING_INTERFACE"]
- source:
objref:
kind: VariableCatalogue
kind: NetworkCatalogue
name: networking
fieldref: ironic.provisioningIp
fieldref: spec.ironic.provisioningIp
target:
objref:
kind: ConfigMap
@ -31,9 +31,9 @@ replacements:
fieldrefs: ["data.PROVISIONING_IP"]
- source:
objref:
kind: VariableCatalogue
kind: NetworkCatalogue
name: networking
fieldref: ironic.dhcpRange
fieldref: spec.ironic.dhcpRange
target:
objref:
kind: ConfigMap

View File

@ -11,9 +11,9 @@ replacements:
# Substring-replace the ephemeral control plane's info
- source:
objref:
kind: VariableCatalogue
kind: NetworkCatalogue
name: networking
fieldref: kubernetes.controlPlaneEndpoint.host
fieldref: spec.kubernetes.controlPlaneEndpoint.host
target:
objref:
name: ephemeral-bmc-secret
@ -21,9 +21,9 @@ replacements:
fieldrefs: ["stringData.userData%REPLACEMENT_CP_IP%"]
- source:
objref:
kind: VariableCatalogue
kind: NetworkCatalogue
name: networking
fieldref: kubernetes.controlPlaneEndpoint.port
fieldref: spec.kubernetes.controlPlaneEndpoint.port
target:
objref:
name: ephemeral-bmc-secret
@ -31,9 +31,9 @@ replacements:
fieldrefs: ["stringData.userData%REPLACEMENT_CP_PORT%"]
- source:
objref:
kind: VariableCatalogue
kind: NetworkCatalogue
name: networking
fieldref: kubernetes.apiserverCertSANs
fieldref: spec.kubernetes.apiserverCertSANs
target:
objref:
name: ephemeral-bmc-secret
@ -41,9 +41,9 @@ replacements:
fieldrefs: ["stringData.userData%REPLACEMENT_CERT_SANS%"]
- source:
objref:
kind: VariableCatalogue
kind: NetworkCatalogue
name: networking
fieldref: kubernetes.podCidr
fieldref: spec.kubernetes.podCidr
target:
objref:
name: ephemeral-bmc-secret

View File

@ -29,9 +29,9 @@ replacements:
fieldrefs: ["{.values.hostsToGenerate}"]
- source:
objref:
kind: VariableCatalogue
kind: NetworkCatalogue
name: networking
fieldref: "{.commonHostNetworking}"
fieldref: "{.spec.commonHostNetworking}"
target:
objref:
kind: Templater

View File

@ -16,18 +16,18 @@ replacements:
# Replace the pod & service networks
- source:
objref:
kind: VariableCatalogue
kind: NetworkCatalogue
name: networking
fieldref: kubernetes.serviceCidr
fieldref: spec.kubernetes.serviceCidr
target:
objref:
kind: Cluster
fieldrefs: ["spec.clusterNetwork.services.cidrBlocks.0"]
- source:
objref:
kind: VariableCatalogue
kind: NetworkCatalogue
name: networking
fieldref: kubernetes.podCidr
fieldref: spec.kubernetes.podCidr
target:
objref:
kind: Cluster
@ -36,9 +36,9 @@ replacements:
# Replace the k8s controlplane host endpoint
- source:
objref:
kind: VariableCatalogue
kind: NetworkCatalogue
name: networking
fieldref: kubernetes.controlPlaneEndpoint
fieldref: spec.kubernetes.controlPlaneEndpoint
target:
objref:
kind: Metal3Cluster

View File

@ -11,7 +11,7 @@ patches: |-
$patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
kind: NetworkCatalogue
metadata:
name: networking
$patch: delete

View File

@ -2,19 +2,18 @@
# 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
kind: NetworkCatalogue
metadata:
name: networking
spec:
# 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]"
# 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"
ironic:
provisioningIp: "10.23.24.101"
dhcpRange: "10.23.24.200,10.23.24.250"

View File

@ -11,7 +11,7 @@ patches: |-
$patch: delete
---
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
kind: NetworkCatalogue
metadata:
name: networking
$patch: delete

View File

@ -2,18 +2,17 @@
# 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
kind: NetworkCatalogue
metadata:
name: networking
spec:
# 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]"
# 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"
ironic:
provisioningIp: "10.23.24.102"
dhcpRange: "10.23.24.200,10.23.24.250"

View File

@ -1,45 +1,45 @@
# The default networking catalogue for site- and operator-specific networking.
# These values can be overridden at the site, type, etc levels as appropriate.
apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue
kind: NetworkCatalogue
metadata:
name: networking
labels:
airshipit.org/deploy-k8s: "false"
# 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:
- id: oam
name: oam
type: phy
mtu: "1500"
# ethernet_mac_address: <from host-catalogue> (optional)
- id: pxe
name: pxe
type: phy
mtu: "1500"
# ethernet_mac_address: <from host-catalogue> (optional)
networks:
- id: oam-ipv4
type: ipv4
link: oam
# ip_address: <from host-catalogue>
netmask: 255.255.255.0
routes:
- network: 0.0.0.0
netmask: 0.0.0.0
gateway: 10.23.25.1
- id: pxe-ipv4
type: ipv4
link: pxe
# ip_address: <from host-catalogue>
netmask: 255.255.255.0
services:
- address: 8.8.8.8
type: dns
- address: 8.8.4.4
type: dns
spec:
# 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:
- id: oam
name: oam
type: phy
mtu: "1500"
# ethernet_mac_address: <from host-catalogue> (optional)
- id: pxe
name: pxe
type: phy
mtu: "1500"
# ethernet_mac_address: <from host-catalogue> (optional)
networks:
- id: oam-ipv4
type: ipv4
link: oam
# ip_address: <from host-catalogue>
netmask: 255.255.255.0
routes:
- network: 0.0.0.0
netmask: 0.0.0.0
gateway: 10.23.25.1
- id: pxe-ipv4
type: ipv4
link: pxe
# ip_address: <from host-catalogue>
netmask: 255.255.255.0
services:
- address: 8.8.8.8
type: dns
- address: 8.8.4.4
type: dns