Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Merge pull request #926 from rabi/ordered_dnsdata
Browse files Browse the repository at this point in the history
Order nodes  when creating dnsdata
  • Loading branch information
openshift-merge-bot[bot] authored Jun 7, 2024
2 parents b6af43d + fe48062 commit c70f433
Show file tree
Hide file tree
Showing 3 changed files with 332 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/deployment/ipam.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"errors"
"fmt"
"sort"
"strings"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -91,7 +92,17 @@ func createOrPatchDNSData(ctx context.Context, helper *helper.Helper,
dnsDetails.AllIPs = map[string]map[infranetworkv1.NetNameStr]string{}

// Build DNSData CR
for _, node := range instance.Spec.Nodes {
// We need to sort the nodes here, else DNSData.Spec.Hosts would change
// For every reconcile and it could create reconcile loops.
nodes := instance.Spec.Nodes
sortedNodeNames := make([]string, 0)
for name := range instance.Spec.Nodes {
sortedNodeNames = append(sortedNodeNames, name)
}
sort.Strings(sortedNodeNames)

for _, nodeName := range sortedNodeNames {
node := nodes[nodeName]
var shortName string
nets := node.Networks
hostName := node.HostName
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
apiVersion: dataplane.openstack.org/v1beta1
kind: OpenStackDataPlaneNodeSet
metadata:
name: openstack-edpm-multinode
status:
allHostnames:
edpm-compute-0:
ctlplane: edpm-compute-0.ctlplane.example.com
internalapi: edpm-compute-0.internalapi.example.com
storage: edpm-compute-0.storage.example.com
tenant: edpm-compute-0.tenant.example.com
edpm-compute-1:
ctlplane: edpm-compute-1.ctlplane.example.com
internalapi: edpm-compute-1.internalapi.example.com
storage: edpm-compute-1.storage.example.com
tenant: edpm-compute-1.tenant.example.com
allIPs:
edpm-compute-0:
ctlplane: 192.168.122.100
internalapi: 172.17.0.100
storage: 172.18.0.100
tenant: 172.19.0.100
edpm-compute-1:
ctlplane: 192.168.122.101
internalapi: 172.17.0.101
storage: 172.18.0.101
tenant: 172.19.0.101
observedGeneration: 1
ctlplaneSearchDomain: ctlplane.example.com
conditions:
- message: Deployment not started
reason: Requested
status: "False"
type: Ready
- message: Deployment not started
reason: Requested
status: "False"
type: DeploymentReady
- message: Input data complete
reason: Ready
status: "True"
type: InputReady
- message: NodeSetDNSDataReady ready
reason: Ready
status: "True"
type: NodeSetDNSDataReady
- message: NodeSetIPReservationReady ready
reason: Ready
status: "True"
type: NodeSetIPReservationReady
- message: ServiceAccount created
reason: Ready
status: "True"
type: ServiceAccountReady
- message: Setup complete
reason: Ready
status: "True"
type: SetupReady
---
apiVersion: network.openstack.org/v1beta1
kind: IPSet
metadata:
name: edpm-compute-0
status:
conditions:
- message: Setup complete
reason: Ready
status: "True"
type: Ready
- message: Input data complete
reason: Ready
status: "True"
type: InputReady
- message: Reservation successful
reason: Ready
status: "True"
type: ReservationReady
reservations:
- address: 192.168.122.100
cidr: 192.168.122.0/24
dnsDomain: ctlplane.example.com
gateway: 192.168.122.1
mtu: 1500
network: ctlplane
routes:
- destination: 0.0.0.0/0
nexthop: 192.168.122.1
subnet: subnet1
- address: 172.17.0.100
cidr: 172.17.0.0/24
dnsDomain: internalapi.example.com
mtu: 1500
network: internalapi
subnet: subnet1
vlan: 20
- address: 172.18.0.100
cidr: 172.18.0.0/24
dnsDomain: storage.example.com
mtu: 1500
network: storage
subnet: subnet1
vlan: 21
- address: 172.19.0.100
cidr: 172.19.0.0/24
dnsDomain: tenant.example.com
mtu: 1500
network: tenant
subnet: subnet1
vlan: 22
---
apiVersion: network.openstack.org/v1beta1
kind: IPSet
metadata:
name: edpm-compute-1
status:
conditions:
- message: Setup complete
reason: Ready
status: "True"
type: Ready
- message: Input data complete
reason: Ready
status: "True"
type: InputReady
- message: Reservation successful
reason: Ready
status: "True"
type: ReservationReady
reservations:
- address: 192.168.122.101
cidr: 192.168.122.0/24
dnsDomain: ctlplane.example.com
gateway: 192.168.122.1
mtu: 1500
network: ctlplane
routes:
- destination: 0.0.0.0/0
nexthop: 192.168.122.1
subnet: subnet1
- address: 172.17.0.101
cidr: 172.17.0.0/24
dnsDomain: internalapi.example.com
mtu: 1500
network: internalapi
subnet: subnet1
vlan: 20
- address: 172.18.0.101
cidr: 172.18.0.0/24
dnsDomain: storage.example.com
mtu: 1500
network: storage
subnet: subnet1
vlan: 21
- address: 172.19.0.101
cidr: 172.19.0.0/24
dnsDomain: tenant.example.com
mtu: 1500
network: tenant
subnet: subnet1
vlan: 22
---
apiVersion: network.openstack.org/v1beta1
kind: DNSData
metadata:
name: openstack-edpm-multinode
spec:
dnsDataLabelSelectorValue: dnsdata
hosts:
- hostnames:
- edpm-compute-0.ctlplane.example.com
ip: 192.168.122.100
- hostnames:
- edpm-compute-0.internalapi.example.com
ip: 172.17.0.100
- hostnames:
- edpm-compute-0.storage.example.com
ip: 172.18.0.100
- hostnames:
- edpm-compute-0.tenant.example.com
ip: 172.19.0.100
- hostnames:
- edpm-compute-1.ctlplane.example.com
ip: 192.168.122.101
- hostnames:
- edpm-compute-1.internalapi.example.com
ip: 172.17.0.101
- hostnames:
- edpm-compute-1.storage.example.com
ip: 172.18.0.101
- hostnames:
- edpm-compute-1.tenant.example.com
ip: 172.19.0.101
status:
conditions:
- message: Setup complete
reason: Ready
status: "True"
type: Ready
- message: Input data complete
reason: Ready
status: "True"
type: ServiceConfigReady
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: network-config-template
data:
network_config_template: |
---
{% set mtu_list = [ctlplane_mtu] %}
{% for network in nodeset_networks %}
{{ mtu_list.append(lookup('vars', networks_lower[network] ~ '_mtu')) }}
{%- endfor %}
{% set min_viable_mtu = mtu_list | max %}
network_config:
- type: ovs_bridge
name: {{ neutron_physical_bridge_name }}
mtu: {{ min_viable_mtu }}
use_dhcp: false
dns_servers: {{ ctlplane_dns_nameservers }}
domain: {{ dns_search_domains }}
addresses:
- ip_netmask: {{ ctlplane_ip }}/{{ ctlplane_cidr }}
routes: {{ ctlplane_host_routes }}
members:
- type: interface
name: nic1
mtu: {{ min_viable_mtu }}
# force the MAC address of the bridge to this interface
primary: true
{% for network in nodeset_networks %}
- type: vlan
mtu: {{ lookup('vars', networks_lower[network] ~ '_mtu') }}
vlan_id: {{ lookup('vars', networks_lower[network] ~ '_vlan_id') }}
addresses:
- ip_netmask:
{{ lookup('vars', networks_lower[network] ~ '_ip') }}/{{ lookup('vars', networks_lower[network] ~ '_cidr') }}
routes: {{ lookup('vars', networks_lower[network] ~ '_host_routes') }}
{% endfor %}
---
apiVersion: dataplane.openstack.org/v1beta1
kind: OpenStackDataPlaneNodeSet
metadata:
name: openstack-edpm-multinode
spec:
env:
- name: ANSIBLE_FORCE_COLOR
value: "True"
services:
- download-cache
- bootstrap
- configure-network
- validate-network
- install-os
- configure-os
- run-os
- install-certs
- ovn
- neutron-metadata
- libvirt
- nova
preProvisioned: true
nodes:
edpm-compute-1:
hostName: edpm-compute-1
networks:
- name: ctlplane
subnetName: subnet1
defaultRoute: true
fixedIP: 192.168.122.101
- name: internalapi
subnetName: subnet1
fixedIP: 172.17.0.101
- name: storage
subnetName: subnet1
fixedIP: 172.18.0.101
- name: tenant
subnetName: subnet1
fixedIP: 172.19.0.101
edpm-compute-0:
hostName: edpm-compute-0
networks:
- name: ctlplane
subnetName: subnet1
defaultRoute: true
fixedIP: 192.168.122.100
- name: internalapi
subnetName: subnet1
fixedIP: 172.17.0.100
- name: storage
subnetName: subnet1
fixedIP: 172.18.0.100
- name: tenant
subnetName: subnet1
fixedIP: 172.19.0.100
nodeTemplate:
ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret
ansible:
ansibleUser: cloud-admin
ansiblePort: 22
ansibleVarsFrom:
- prefix: edpm_
configMapRef:
name: network-config-template
ansibleVars:
timesync_ntp_servers:
- hostname: clock.redhat.com
# edpm_network_config
# Default nic config template for a EDPM compute node
# These vars are edpm_network_config role vars
edpm_network_config_hide_sensitive_logs: false
edpm_nodes_validation_validate_controllers_icmp: false
edpm_nodes_validation_validate_gateway_icmp: false
gather_facts: false
enable_debug: false
# edpm firewall, change the allowed CIDR if needed
edpm_sshd_configure_firewall: true
edpm_sshd_allowed_ranges: ['192.168.122.0/24']
# SELinux module
edpm_selinux_mode: enforcing

0 comments on commit c70f433

Please sign in to comment.