diff --git a/api/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml b/api/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml index cf10ee39a..2f52bd393 100644 --- a/api/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml +++ b/api/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml @@ -1035,11 +1035,10 @@ spec: type: array managementNetwork: type: string - networkConfig: - properties: - template: - type: string - type: object + networkAttachments: + items: + type: string + type: array networkData: properties: name: @@ -1840,11 +1839,6 @@ spec: type: string managementNetwork: type: string - networkConfig: - properties: - template: - type: string - type: object networkData: properties: name: diff --git a/api/v1beta1/common.go b/api/v1beta1/common.go index e8b60f992..0c9737bed 100644 --- a/api/v1beta1/common.go +++ b/api/v1beta1/common.go @@ -52,11 +52,6 @@ type NodeSection struct { // +kubebuilder:validation:Optional HostName string `json:"hostName,omitempty"` - // NetworkConfig - Network configuration details. Contains os-net-config - // related properties. - // +kubebuilder:validation:Optional - NetworkConfig NetworkConfigSection `json:"networkConfig"` - // Networks - Instance networks // +kubebuilder:validation:Optional Networks []infranetworkv1.IPSetNetwork `json:"networks,omitempty"` @@ -93,10 +88,10 @@ type NodeTemplate struct { // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:io.kubernetes:Secret"} AnsibleSSHPrivateKeySecret string `json:"ansibleSSHPrivateKeySecret"` - // NetworkConfig - Network configuration details. Contains os-net-config - // related properties. + // NetworkAttachments is a list of NetworkAttachment resource names to pass to the ansibleee resource + // which allows to connect the ansibleee runner to the given network // +kubebuilder:validation:Optional - NetworkConfig NetworkConfigSection `json:"networkConfig,omitempty"` + NetworkAttachments []string `json:"networkAttachments,omitempty"` // Networks - Instance networks // +kubebuilder:validation:Optional @@ -143,15 +138,6 @@ type DeployStrategySection struct { AnsibleSkipTags string `json:"ansibleSkipTags,omitempty"` } -// NetworkConfigSection is a specification of the Network configuration details -type NetworkConfigSection struct { - - // Template - Contains a Ansible j2 nic config template to use when applying node - // network configuration - // +kubebuilder:validation:Optional - Template string `json:"template,omitempty" yaml:"template,omitempty"` -} - // AnsibleEESpec is a specification of the ansible EE attributes type AnsibleEESpec struct { // +kubebuilder:validation:Optional diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 7f5591692..2dc71697f 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -129,25 +129,9 @@ func (in *KubeService) DeepCopy() *KubeService { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *NetworkConfigSection) DeepCopyInto(out *NetworkConfigSection) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkConfigSection. -func (in *NetworkConfigSection) DeepCopy() *NetworkConfigSection { - if in == nil { - return nil - } - out := new(NetworkConfigSection) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeSection) DeepCopyInto(out *NodeSection) { *out = *in - out.NetworkConfig = in.NetworkConfig if in.Networks != nil { in, out := &in.Networks, &out.Networks *out = make([]networkv1beta1.IPSetNetwork, len(*in)) @@ -188,7 +172,11 @@ func (in *NodeSection) DeepCopy() *NodeSection { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *NodeTemplate) DeepCopyInto(out *NodeTemplate) { *out = *in - out.NetworkConfig = in.NetworkConfig + if in.NetworkAttachments != nil { + in, out := &in.NetworkAttachments, &out.NetworkAttachments + *out = make([]string, len(*in)) + copy(*out, *in) + } if in.Networks != nil { in, out := &in.Networks, &out.Networks *out = make([]networkv1beta1.IPSetNetwork, len(*in)) diff --git a/config/crd/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml b/config/crd/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml index cf10ee39a..2f52bd393 100644 --- a/config/crd/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml +++ b/config/crd/bases/dataplane.openstack.org_openstackdataplanenodesets.yaml @@ -1035,11 +1035,10 @@ spec: type: array managementNetwork: type: string - networkConfig: - properties: - template: - type: string - type: object + networkAttachments: + items: + type: string + type: array networkData: properties: name: @@ -1840,11 +1839,6 @@ spec: type: string managementNetwork: type: string - networkConfig: - properties: - template: - type: string - type: object networkData: properties: name: diff --git a/config/samples/dataplane_v1beta1_openstackdataplane_baremetal_with_ipam.yaml b/config/samples/dataplane_v1beta1_openstackdataplane_baremetal_with_ipam.yaml new file mode 100644 index 000000000..0cb3ffefa --- /dev/null +++ b/config/samples/dataplane_v1beta1_openstackdataplane_baremetal_with_ipam.yaml @@ -0,0 +1,164 @@ +apiVersion: dataplane.openstack.org/v1beta1 +kind: OpenStackDataPlaneNodeSet +metadata: + name: openstack-edpm-ipam +spec: + env: + - name: ANSIBLE_FORCE_COLOR + value: "True" + - name: ANSIBLE_ENABLE_TASK_DEBUGGER + value: "True" + services: + - configure-network + - validate-network + - install-os + - configure-os + - run-os + - ovn + - libvirt + - nova + deployStrategy: + deploy: true + baremetalSetTemplate: + bmhNamespace: openstack + deploymentSSHSecret: dataplane-ansible-ssh-private-key-secret + bmhLabelSelector: + app: openstack + ctlplaneInterface: enp1s0 + dnsSearchDomains: + - osptest.openstack.org + cloudUserName: cloud-admin + nodeTemplate: + ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret + nodes: + edpm-compute-0: + hostName: edpm-compute-0 + ansible: + ansibleUser: root + ansibleHost: 192.168.122.100 + ansibleVars: + ctlplane_ip: 192.168.122.100 + internal_api_ip: 172.17.0.100 + storage_ip: 172.18.0.100 + tenant_ip: 172.19.0.100 + fqdn_internal_api: edpm-compute-0.example.com + networks: + - name: CtlPlane + subnetName: subnet1 + defaultRoute: true + fixedIP: 192.168.122.100 + - name: InternalApi + subnetName: subnet1 + - name: Storage + subnetName: subnet1 + - name: Tenant + subnetName: subnet1 + managementNetwork: ctlplane + ansible: + ansibleUser: root + ansiblePort: 22 + ansibleVars: + service_net_map: + nova_api_network: internal_api + nova_libvirt_network: internal_api + edpm_chrony_ntp_servers: + - 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_network_config_template: | + --- + {% set mtu_list = [ctlplane_mtu] %} + {% for network in role_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_subnet_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 role_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 %} + # These vars are for the network config templates themselves and are + # considered EDPM network defaults. + neutron_physical_bridge_name: br-ex + neutron_public_interface_name: eth0 + ctlplane_mtu: 1500 + ctlplane_subnet_cidr: 24 + ctlplane_gateway_ip: 192.168.122.1 + ctlplane_host_routes: + - ip_netmask: 0.0.0.0/0 + next_hop: 192.168.122.1 + external_mtu: 1500 + external_vlan_id: 44 + external_cidr: '24' + external_host_routes: [] + internal_api_mtu: 1500 + internal_api_vlan_id: 20 + internal_api_cidr: '24' + internal_api_host_routes: [] + storage_mtu: 1500 + storage_vlan_id: 21 + storage_cidr: '24' + storage_host_routes: [] + tenant_mtu: 1500 + tenant_vlan_id: 22 + tenant_cidr: '24' + tenant_host_routes: [] + role_networks: + - InternalApi + - Storage + - Tenant + networks_lower: + External: external + InternalApi: internal_api + Storage: storage + Tenant: tenant + # edpm_nodes_validation + edpm_nodes_validation_validate_controllers_icmp: false + edpm_nodes_validation_validate_gateway_icmp: false + edpm_ovn_metadata_agent_DEFAULT_transport_url: rabbit://default_user@rabbitmq.openstack.svc:5672 + edpm_ovn_metadata_agent_metadata_agent_ovn_ovn_sb_connection: tcp:10.217.5.121:6642 + edpm_ovn_metadata_agent_metadata_agent_DEFAULT_nova_metadata_host: 127.0.0.1 + edpm_ovn_metadata_agent_metadata_agent_DEFAULT_metadata_proxy_shared_secret: 12345678 + edpm_ovn_metadata_agent_DEFAULT_bind_host: 127.0.0.1 + ctlplane_dns_nameservers: + - 192.168.122.1 + dns_search_domains: [] + edpm_ovn_dbs: + - 192.168.122.1 + registry_url: quay.io/podified-antelope-centos9 + image_tag: current-podified + edpm_ovn_controller_agent_image: "{{ registry_url }}/openstack-ovn-controller:{{ image_tag }}" + edpm_iscsid_image: "{{ registry_url }}/openstack-iscsid:{{ image_tag }}" + edpm_logrotate_crond_image: "{{ registry_url }}/openstack-cron:{{ image_tag }}" + edpm_nova_compute_container_image: "{{ registry_url }}/openstack-nova-compute:{{ image_tag }}" + edpm_nova_libvirt_container_image: "{{ registry_url }}/openstack-nova-libvirt:{{ image_tag }}" + edpm_ovn_metadata_agent_image: "{{ registry_url }}/openstack-neutron-metadata-agent-ovn:{{ image_tag }}" + 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 diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenodeset.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenodeset.yaml index 3e2464673..0114717e5 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenodeset.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenodeset.yaml @@ -48,7 +48,39 @@ spec: # 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_network_config_template: templates/single_nic_vlans/single_nic_vlans.j2 + edpm_network_config_template: | + --- + {% set mtu_list = [ctlplane_mtu] %} + {% for network in role_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_subnet_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 role_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 %} + # These vars are for the network config templates themselves and are # considered EDPM network defaults. neutron_physical_bridge_name: br-ex diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal.yaml index 65d3b37ad..66cf7ea53 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal.yaml @@ -67,9 +67,39 @@ spec: # edpm_network_config # Default nic config template for a EDPM compute node # These vars are edpm_network_config role vars - edpm_network_config_template: templates/single_nic_vlans/single_nic_vlans.j2 edpm_network_config_hide_sensitive_logs: false - + edpm_network_config_template: | + --- + {% set mtu_list = [ctlplane_mtu] %} + {% for network in role_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_subnet_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 role_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 %} # These vars are for the network config templates themselves and are # considered EDPM network defaults. neutron_physical_bridge_name: br-ex diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal_with_ipam.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal_with_ipam.yaml index 1c82b505e..5a84aff50 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal_with_ipam.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_baremetal_with_ipam.yaml @@ -54,7 +54,38 @@ spec: # 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_network_config_template: templates/single_nic_vlans/single_nic_vlans.j2 + edpm_network_config_template: | + --- + {% set mtu_list = [ctlplane_mtu] %} + {% for network in role_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_subnet_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 role_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 %} # These vars are for the network config templates themselves and are # considered EDPM network defaults. neutron_physical_bridge_name: br-ex diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_ceph.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_ceph.yaml index 11f8777f5..76f1d128a 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_ceph.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_ceph.yaml @@ -56,7 +56,39 @@ spec: # edpm_network_config # Default nic config template for a EDPM compute node # These vars are edpm_network_config role vars - edpm_network_config_template: templates/single_nic_vlans/single_nic_vlans.j2 + edpm_network_config_template: | + --- + {% set mtu_list = [ctlplane_mtu] %} + {% for network in role_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_subnet_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 role_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 %} + edpm_network_config_hide_sensitive_logs: false # # These vars are for the network config templates themselves and are diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_customnetworks.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_customnetworks.yaml index 92933011e..0c66fd5e3 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_customnetworks.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_customnetworks.yaml @@ -48,7 +48,38 @@ spec: # edpm_network_config # Default nic config template for a EDPM compute node # These vars are edpm_network_config role vars - edpm_network_config_template: /runner/network/nic-config-template + edpm_network_config_template: | + --- + {% set mtu_list = [ctlplane_mtu] %} + {% for network in role_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_subnet_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 role_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 %} edpm_network_config_hide_sensitive_logs: false edpm_network_config_update: false # diff --git a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_with_ipam.yaml b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_with_ipam.yaml index ad262f667..fd9759b15 100644 --- a/config/samples/dataplane_v1beta1_openstackdataplanenodeset_with_ipam.yaml +++ b/config/samples/dataplane_v1beta1_openstackdataplanenodeset_with_ipam.yaml @@ -66,6 +66,38 @@ spec: # edpm_network_config # Default nic config template for a EDPM compute node # These vars are edpm_network_config role vars + edpm_network_config_template: | + --- + {% set mtu_list = [ctlplane_mtu] %} + {% for network in role_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_subnet_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 role_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 %} edpm_network_config_hide_sensitive_logs: false # These vars are for the network config templates themselves and are # considered EDPM network defaults. diff --git a/docs/openstack_dataplanenodeset.md b/docs/openstack_dataplanenodeset.md index 218634e75..6cf335c1d 100644 --- a/docs/openstack_dataplanenodeset.md +++ b/docs/openstack_dataplanenodeset.md @@ -8,7 +8,6 @@ * [AnsibleEESpec](#ansibleeespec) * [AnsibleOpts](#ansibleopts) * [DeployStrategySection](#deploystrategysection) -* [NetworkConfigSection](#networkconfigsection) * [NodeSection](#nodesection) * [NodeTemplate](#nodetemplate) * [OpenStackDataPlaneNodeSetList](#openstackdataplanenodesetlist) @@ -58,16 +57,6 @@ DeployStrategySection for fields controlling the deployment [Back to Custom Resources](#custom-resources) -#### NetworkConfigSection - -NetworkConfigSection is a specification of the Network configuration details - -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| template | Template - Contains a Ansible j2 nic config template to use when applying node network configuration | string | false | - -[Back to Custom Resources](#custom-resources) - #### NodeSection NodeSection defines the top level attributes inherited by nodes in the CR. @@ -75,7 +64,6 @@ NodeSection defines the top level attributes inherited by nodes in the CR. | Field | Description | Scheme | Required | | ----- | ----------- | ------ | -------- | | hostName | HostName - node name | string | false | -| networkConfig | NetworkConfig - Network configuration details. Contains os-net-config related properties. | [NetworkConfigSection](#networkconfigsection) | true | | networks | Networks - Instance networks | []infranetworkv1.IPSetNetwork | false | | managementNetwork | ManagementNetwork - Name of network to use for management (SSH/Ansible) | string | false | | ansible | Ansible is the group of Ansible related configuration options. | [AnsibleOpts](#ansibleopts) | false | @@ -92,7 +80,7 @@ NodeTemplate is a specification of the node attributes that override top level a | Field | Description | Scheme | Required | | ----- | ----------- | ------ | -------- | | ansibleSSHPrivateKeySecret | AnsibleSSHPrivateKeySecret Name of a private SSH key secret containing private SSH key for connecting to node. The named secret must be of the form: Secret.data.ssh-privatekey: | string | true | -| networkConfig | NetworkConfig - Network configuration details. Contains os-net-config related properties. | [NetworkConfigSection](#networkconfigsection) | false | +| networkAttachments | NetworkAttachments is a list of NetworkAttachment resource names to pass to the ansibleee resource which allows to connect the ansibleee runner to the given network | []string | false | | networks | Networks - Instance networks | []infranetworkv1.IPSetNetwork | false | | managementNetwork | ManagementNetwork - Name of network to use for management (SSH/Ansible) | string | false | | ansible | Ansible is the group of Ansible related configuration options. | [AnsibleOpts](#ansibleopts) | false | diff --git a/docs/openstack_dataplaneservice.md b/docs/openstack_dataplaneservice.md index a1d39c92c..2156d43b0 100644 --- a/docs/openstack_dataplaneservice.md +++ b/docs/openstack_dataplaneservice.md @@ -8,7 +8,6 @@ * [AnsibleEESpec](#ansibleeespec) * [AnsibleOpts](#ansibleopts) * [DeployStrategySection](#deploystrategysection) -* [NetworkConfigSection](#networkconfigsection) * [NodeSection](#nodesection) * [NodeTemplate](#nodetemplate) * [KubeService](#kubeservice) @@ -59,16 +58,6 @@ DeployStrategySection for fields controlling the deployment [Back to Custom Resources](#custom-resources) -#### NetworkConfigSection - -NetworkConfigSection is a specification of the Network configuration details - -| Field | Description | Scheme | Required | -| ----- | ----------- | ------ | -------- | -| template | Template - Contains a Ansible j2 nic config template to use when applying node network configuration | string | false | - -[Back to Custom Resources](#custom-resources) - #### NodeSection NodeSection defines the top level attributes inherited by nodes in the CR. @@ -76,7 +65,6 @@ NodeSection defines the top level attributes inherited by nodes in the CR. | Field | Description | Scheme | Required | | ----- | ----------- | ------ | -------- | | hostName | HostName - node name | string | false | -| networkConfig | NetworkConfig - Network configuration details. Contains os-net-config related properties. | [NetworkConfigSection](#networkconfigsection) | true | | networks | Networks - Instance networks | []infranetworkv1.IPSetNetwork | false | | managementNetwork | ManagementNetwork - Name of network to use for management (SSH/Ansible) | string | false | | ansible | Ansible is the group of Ansible related configuration options. | [AnsibleOpts](#ansibleopts) | false | @@ -93,7 +81,7 @@ NodeTemplate is a specification of the node attributes that override top level a | Field | Description | Scheme | Required | | ----- | ----------- | ------ | -------- | | ansibleSSHPrivateKeySecret | AnsibleSSHPrivateKeySecret Name of a private SSH key secret containing private SSH key for connecting to node. The named secret must be of the form: Secret.data.ssh-privatekey: | string | true | -| networkConfig | NetworkConfig - Network configuration details. Contains os-net-config related properties. | [NetworkConfigSection](#networkconfigsection) | false | +| networkAttachments | NetworkAttachments is a list of NetworkAttachment resource names to pass to the ansibleee resource which allows to connect the ansibleee runner to the given network | []string | false | | networks | Networks - Instance networks | []infranetworkv1.IPSetNetwork | false | | managementNetwork | ManagementNetwork - Name of network to use for management (SSH/Ansible) | string | false | | ansible | Ansible is the group of Ansible related configuration options. | [AnsibleOpts](#ansibleopts) | false | diff --git a/pkg/deployment/inventory.go b/pkg/deployment/inventory.go index fee15efbb..bdedecec9 100644 --- a/pkg/deployment/inventory.go +++ b/pkg/deployment/inventory.go @@ -93,11 +93,6 @@ func GenerateNodeSetInventory(ctx context.Context, helper *helper.Helper, host.Vars[entry+"_host_routes"] = res.Routes dnsSearchDomains = append(dnsSearchDomains, res.DNSDomain) } - networkConfig := getAnsibleNetworkConfig(instance, nodeName) - - if networkConfig.Template != "" { - host.Vars["edpm_network_config_template"] = NicConfigTemplateFile - } host.Vars["ansible_user"] = getAnsibleUser(instance, nodeName) host.Vars["ansible_port"] = getAnsiblePort(instance, nodeName) @@ -134,7 +129,6 @@ func GenerateNodeSetInventory(ctx context.Context, helper *helper.Helper, } secretData := map[string]string{ "inventory": string(invData), - "network": string(instance.Spec.NodeTemplate.NetworkConfig.Template), } secretName := fmt.Sprintf("dataplanenodeset-%s", instance.Name) template := []utils.Template{ @@ -215,14 +209,6 @@ func getAnsibleManagementNetwork( return instance.Spec.NodeTemplate.ManagementNetwork } -// getAnsibleNetworkConfig returns a JSON string value from the template unless it is set in the node -func getAnsibleNetworkConfig(instance *dataplanev1.OpenStackDataPlaneNodeSet, nodeName string) dataplanev1.NetworkConfigSection { - if instance.Spec.Nodes[nodeName].NetworkConfig.Template != "" { - return instance.Spec.Nodes[nodeName].NetworkConfig - } - return instance.Spec.NodeTemplate.NetworkConfig -} - // getAnsibleNetworks returns a JSON string mapping fixedIP and/or network name to their valules func getAnsibleNetworks(instance *dataplanev1.OpenStackDataPlaneNodeSet, nodeName string) []infranetworkv1.IPSetNetwork { if len(instance.Spec.Nodes[nodeName].Networks) > 0 { @@ -296,9 +282,6 @@ func resolveAnsibleVars(nodeTemplate *dataplanev1.NodeTemplate, host *ansible.Ho if nodeTemplate.ManagementNetwork != "" { ansibleVarsData["management_network"] = nodeTemplate.ManagementNetwork } - if nodeTemplate.NetworkConfig.Template != "" { - ansibleVarsData["edpm_network_config_template"] = NicConfigTemplateFile - } if len(nodeTemplate.Networks) > 0 { ansibleVarsData["networks"] = nodeTemplate.Networks } @@ -340,9 +323,6 @@ func resolveNodeAnsibleVars(node *dataplanev1.NodeSection, host *ansible.Host, g if node.ManagementNetwork != "" { ansibleVarsData["management_network"] = node.ManagementNetwork } - if node.NetworkConfig.Template != "" { - ansibleVarsData["edpm_network_config_template"] = NicConfigTemplateFile - } if len(node.Networks) > 0 { ansibleVarsData["networks"] = node.Networks } diff --git a/pkg/util/ansible_execution.go b/pkg/util/ansible_execution.go index f7fd0cbbc..213cae427 100644 --- a/pkg/util/ansible_execution.go +++ b/pkg/util/ansible_execution.go @@ -127,10 +127,6 @@ func AnsibleExecution( Key: "inventory", Path: "inventory", }, - { - Key: "network", - Path: "network", - }, }, }, }, @@ -140,17 +136,11 @@ func AnsibleExecution( MountPath: "/runner/inventory/hosts", SubPath: "inventory", } - networkConfigMount := corev1.VolumeMount{ - Name: "inventory", - MountPath: "/runner/network/nic-config-template", - SubPath: "network", - } ansibleEEMounts.Volumes = append(ansibleEEMounts.Volumes, sshKeyVolume) ansibleEEMounts.Volumes = append(ansibleEEMounts.Volumes, inventoryVolume) ansibleEEMounts.Mounts = append(ansibleEEMounts.Mounts, sshKeyMount) ansibleEEMounts.Mounts = append(ansibleEEMounts.Mounts, inventoryMount) - ansibleEEMounts.Mounts = append(ansibleEEMounts.Mounts, networkConfigMount) ansibleEE.Spec.ExtraMounts = append(aeeSpec.ExtraMounts, []storage.VolMounts{ansibleEEMounts}...) ansibleEE.Spec.Env = aeeSpec.Env diff --git a/tests/kuttl/tests/dataplane-deploy-no-nodes-test/01-assert.yaml b/tests/kuttl/tests/dataplane-deploy-no-nodes-test/01-assert.yaml index bc4071418..54bfe7d7b 100644 --- a/tests/kuttl/tests/dataplane-deploy-no-nodes-test/01-assert.yaml +++ b/tests/kuttl/tests/dataplane-deploy-no-nodes-test/01-assert.yaml @@ -101,9 +101,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - - mountPath: /runner/network/nic-config-template - name: inventory - subPath: network volumes: - name: ssh-key secret: @@ -116,8 +113,6 @@ spec: items: - key: inventory path: inventory - - key: network - path: network secretName: dataplanenodeset-edpm-compute-no-nodes image: quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest name: openstackansibleee @@ -157,9 +152,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - - mountPath: /runner/network/nic-config-template - name: inventory - subPath: network volumes: - name: ssh-key secret: @@ -172,8 +164,6 @@ spec: items: - key: inventory path: inventory - - key: network - path: network secretName: dataplanenodeset-edpm-compute-no-nodes image: quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest name: openstackansibleee @@ -213,9 +203,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - - mountPath: /runner/network/nic-config-template - name: inventory - subPath: network volumes: - name: ssh-key secret: @@ -228,8 +215,6 @@ spec: items: - key: inventory path: inventory - - key: network - path: network secretName: dataplanenodeset-edpm-compute-no-nodes image: quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest name: openstackansibleee @@ -269,9 +254,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - - mountPath: /runner/network/nic-config-template - name: inventory - subPath: network volumes: - name: ssh-key secret: @@ -284,8 +266,6 @@ spec: items: - key: inventory path: inventory - - key: network - path: network secretName: dataplanenodeset-edpm-compute-no-nodes image: quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest name: openstackansibleee @@ -326,9 +306,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - - mountPath: /runner/network/nic-config-template - name: inventory - subPath: network volumes: - name: ssh-key secret: @@ -341,8 +318,6 @@ spec: items: - key: inventory path: inventory - - key: network - path: network secretName: dataplanenodeset-edpm-compute-no-nodes image: quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest name: openstackansibleee @@ -382,9 +357,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - - mountPath: /runner/network/nic-config-template - name: inventory - subPath: network volumes: - name: ssh-key secret: @@ -397,8 +369,6 @@ spec: items: - key: inventory path: inventory - - key: network - path: network secretName: dataplanenodeset-edpm-compute-no-nodes image: quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest name: openstackansibleee @@ -450,9 +420,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - - mountPath: /runner/network/nic-config-template - name: inventory - subPath: network volumes: - name: ssh-key secret: @@ -465,8 +432,6 @@ spec: items: - key: inventory path: inventory - - key: network - path: network secretName: dataplanenodeset-edpm-compute-no-nodes image: quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest name: openstackansibleee @@ -500,7 +465,6 @@ spec: backoffLimit: 6 debug: false envConfigMapName: openstack-aee-default-env - extraMounts: - mounts: - mountPath: /runner/env/ssh_key @@ -509,9 +473,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - - mountPath: /runner/network/nic-config-template - name: inventory - subPath: network volumes: - name: ssh-key secret: @@ -524,8 +485,6 @@ spec: items: - key: inventory path: inventory - - key: network - path: network secretName: dataplanenodeset-edpm-compute-no-nodes image: quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest name: openstackansibleee @@ -573,9 +532,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - - mountPath: /runner/network/nic-config-template - name: inventory - subPath: network volumes: - name: ssh-key secret: @@ -588,8 +544,6 @@ spec: items: - key: inventory path: inventory - - key: network - path: network secretName: dataplanenodeset-edpm-compute-no-nodes image: quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest name: openstackansibleee diff --git a/tests/kuttl/tests/dataplane-extramounts/00-assert.yaml b/tests/kuttl/tests/dataplane-extramounts/00-assert.yaml index 980f96137..ceea2dd39 100644 --- a/tests/kuttl/tests/dataplane-extramounts/00-assert.yaml +++ b/tests/kuttl/tests/dataplane-extramounts/00-assert.yaml @@ -51,9 +51,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - - mountPath: /runner/network/nic-config-template - name: inventory - subPath: network volumes: - name: ssh-key secret: @@ -66,6 +63,4 @@ spec: items: - key: inventory path: inventory - - key: network - path: network secretName: dataplanenodeset-edpm-extramounts diff --git a/tests/kuttl/tests/dataplane-service-config/00-assert.yaml b/tests/kuttl/tests/dataplane-service-config/00-assert.yaml index f9f5c6fbb..90cfd14b8 100644 --- a/tests/kuttl/tests/dataplane-service-config/00-assert.yaml +++ b/tests/kuttl/tests/dataplane-service-config/00-assert.yaml @@ -73,9 +73,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - - mountPath: /runner/network/nic-config-template - name: inventory - subPath: network volumes: - name: ssh-key secret: @@ -88,8 +85,6 @@ spec: items: - key: inventory path: inventory - - key: network - path: network secretName: dataplanenodeset-edpm-compute-no-nodes image: quay.io/openstack-k8s-operators/openstack-ansibleee-runner:latest name: openstackansibleee diff --git a/tests/kuttl/tests/dataplane-service-custom-image/00-assert.yaml b/tests/kuttl/tests/dataplane-service-custom-image/00-assert.yaml index 3ea441d5a..7b1359ad1 100644 --- a/tests/kuttl/tests/dataplane-service-custom-image/00-assert.yaml +++ b/tests/kuttl/tests/dataplane-service-custom-image/00-assert.yaml @@ -62,9 +62,6 @@ spec: - mountPath: /runner/inventory/hosts name: inventory subPath: inventory - - mountPath: /runner/network/nic-config-template - name: inventory - subPath: network volumes: - name: ssh-key secret: @@ -77,8 +74,6 @@ spec: items: - key: inventory path: inventory - - key: network - path: network secretName: dataplanenodeset-edpm-no-nodes-custom-service image: example.com/repo/runner-image:latest name: openstackansibleee