Create NetworkCatalogue structural schema CRD

Replaces the networking VariableCatalogue with a
structural schema NetworkCatalogue CRD.

Relates-To: #468
Change-Id: I9973708799ec35c2dde5832e7400c798dc7adae1
This commit is contained in:
Matthew Fuller
2021-02-20 00:35:27 +00:00
parent 3fec6981f0
commit 5820e22d9f
12 changed files with 260 additions and 140 deletions

View File

@@ -1,12 +1,12 @@
# The default networking catalogue for functions hosted in the airshipctl project. # The default networking catalogue for functions hosted in the airshipctl project.
# These values can be overridden at the site, type, etc levels as appropriate. # These values can be overridden at the site, type, etc levels as appropriate.
apiVersion: airshipit.org/v1alpha1 apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue kind: NetworkCatalogue
metadata: metadata:
name: networking name: networking
labels: labels:
airshipit.org/deploy-k8s: "false" airshipit.org/deploy-k8s: "false"
spec:
# The catalogue should be overridden as appropriate for different kubernetes # The catalogue should be overridden as appropriate for different kubernetes
# clusters, e.g. ephemeral vs target vs tenant # clusters, e.g. ephemeral vs target vs tenant
kubernetes: kubernetes:

View File

@@ -1,2 +1,3 @@
resources: resources:
- versions-catalogue.yaml - 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 # Replace the pod & service networks
- source: - source:
objref: objref:
kind: VariableCatalogue kind: NetworkCatalogue
name: networking name: networking
fieldref: ironic.provisioningInterface fieldref: spec.ironic.provisioningInterface
target: target:
objref: objref:
kind: ConfigMap kind: ConfigMap
@@ -21,9 +21,9 @@ replacements:
fieldrefs: ["data.PROVISIONING_INTERFACE"] fieldrefs: ["data.PROVISIONING_INTERFACE"]
- source: - source:
objref: objref:
kind: VariableCatalogue kind: NetworkCatalogue
name: networking name: networking
fieldref: ironic.provisioningIp fieldref: spec.ironic.provisioningIp
target: target:
objref: objref:
kind: ConfigMap kind: ConfigMap
@@ -31,9 +31,9 @@ replacements:
fieldrefs: ["data.PROVISIONING_IP"] fieldrefs: ["data.PROVISIONING_IP"]
- source: - source:
objref: objref:
kind: VariableCatalogue kind: NetworkCatalogue
name: networking name: networking
fieldref: ironic.dhcpRange fieldref: spec.ironic.dhcpRange
target: target:
objref: objref:
kind: ConfigMap kind: ConfigMap

View File

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

View File

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

View File

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

View File

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

View File

@@ -2,10 +2,10 @@
# ephemeral cluster, on top of the target cluster networking definition. # ephemeral cluster, on top of the target cluster networking definition.
# These values can be overridden at the site, type, etc levels as appropriate. # These values can be overridden at the site, type, etc levels as appropriate.
apiVersion: airshipit.org/v1alpha1 apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue kind: NetworkCatalogue
metadata: metadata:
name: networking name: networking
spec:
# The catalogue should be overridden as appropriate for different kubernetes # The catalogue should be overridden as appropriate for different kubernetes
# clusters, e.g. ephemeral vs target vs tenant # clusters, e.g. ephemeral vs target vs tenant
kubernetes: kubernetes:
@@ -17,4 +17,3 @@ kubernetes:
ironic: ironic:
provisioningIp: "10.23.24.101" provisioningIp: "10.23.24.101"
dhcpRange: "10.23.24.200,10.23.24.250" dhcpRange: "10.23.24.200,10.23.24.250"

View File

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

View File

@@ -2,10 +2,10 @@
# ephemeral cluster, on top of the target cluster networking definition. # ephemeral cluster, on top of the target cluster networking definition.
# These values can be overridden at the site, type, etc levels as appropriate. # These values can be overridden at the site, type, etc levels as appropriate.
apiVersion: airshipit.org/v1alpha1 apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue kind: NetworkCatalogue
metadata: metadata:
name: networking name: networking
spec:
# The catalogue should be overridden as appropriate for different kubernetes # The catalogue should be overridden as appropriate for different kubernetes
# clusters, e.g. ephemeral vs target vs tenant # clusters, e.g. ephemeral vs target vs tenant
kubernetes: kubernetes:
@@ -16,4 +16,3 @@ kubernetes:
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

@@ -1,12 +1,12 @@
# The default networking catalogue for site- and operator-specific networking. # The default networking catalogue for site- and operator-specific networking.
# These values can be overridden at the site, type, etc levels as appropriate. # These values can be overridden at the site, type, etc levels as appropriate.
apiVersion: airshipit.org/v1alpha1 apiVersion: airshipit.org/v1alpha1
kind: VariableCatalogue kind: NetworkCatalogue
metadata: metadata:
name: networking name: networking
labels: labels:
airshipit.org/deploy-k8s: "false" airshipit.org/deploy-k8s: "false"
spec:
# This section is only relevant when using Metal3 BareMetalHosts, and # This section is only relevant when using Metal3 BareMetalHosts, and
# is consumed by the `hostgenerator-m3` function. # is consumed by the `hostgenerator-m3` function.
# It defines host-level networking that is common across all BMHs in a site, # It defines host-level networking that is common across all BMHs in a site,