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

Commit

Permalink
Refactor base templates
Browse files Browse the repository at this point in the history
This change removes some unnecessary items from the base config samples.

Namely:
1. Removes unnecessary or unused AnsibleVars such as the selinux
   variable, or variables that are just setting default or unnecessary
   values from edpm-ansible.
2. Limit the number of parameters configured in the baremetal-ipam
   sample, since these are already demonstrated in the base nodeset
   templates. Such as the spec.env example.

Depends-On: openstack-k8s-operators/install_yamls#644
Depends-On: openstack-k8s-operators/edpm-ansible#508
Signed-off-by: Brendan Shephard <[email protected]>
  • Loading branch information
bshephar committed Dec 1, 2023
1 parent f33b749 commit a4eb720
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 238 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ spec:
ansiblePort:
type: integer
ansibleUser:
default: cloud-user
type: string
ansibleVars:
x-kubernetes-preserve-unknown-fields: true
Expand Down Expand Up @@ -1020,6 +1021,7 @@ spec:
type: object
type: array
managementNetwork:
default: ctlplane
type: string
networkData:
properties:
Expand Down Expand Up @@ -1068,6 +1070,7 @@ spec:
ansiblePort:
type: integer
ansibleUser:
default: cloud-user
type: string
ansibleVars:
x-kubernetes-preserve-unknown-fields: true
Expand Down
10 changes: 6 additions & 4 deletions api/v1beta1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import (
type AnsibleOpts struct {
// AnsibleUser SSH user for Ansible connection
// +kubebuilder:validation:Optional
AnsibleUser string `json:"ansibleUser,omitempty"`
// +kubebuilder:default="cloud-user"
AnsibleUser string `json:"ansibleUser"`

// AnsibleHost SSH host for Ansible connection
// +kubebuilder:validation:Optional
Expand All @@ -47,7 +48,6 @@ type AnsibleOpts struct {

// NodeSection defines the top level attributes inherited by nodes in the CR.
type NodeSection struct {

// HostName - node name
// +kubebuilder:validation:Optional
HostName string `json:"hostName,omitempty"`
Expand Down Expand Up @@ -94,7 +94,8 @@ type NodeTemplate struct {

// ManagementNetwork - Name of network to use for management (SSH/Ansible)
// +kubebuilder:validation:Optional
ManagementNetwork string `json:"managementNetwork,omitempty"`
// +kubebuilder:default=ctlplane
ManagementNetwork string `json:"managementNetwork"`

// Ansible is the group of Ansible related configuration options.
// +kubebuilder:validation:Optional
Expand All @@ -116,9 +117,10 @@ type NodeTemplate struct {
// AnsibleEESpec is a specification of the ansible EE attributes
type AnsibleEESpec struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default={ctlplane}
// 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
NetworkAttachments []string `json:"networkAttachments,omitempty"`
NetworkAttachments []string `json:"networkAttachments"`
// +kubebuilder:validation:Optional
// OpenStackAnsibleEERunnerImage image to use as the ansibleEE runner image
OpenStackAnsibleEERunnerImage string `json:"openStackAnsibleEERunnerImage,omitempty"`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ spec:
ansiblePort:
type: integer
ansibleUser:
default: cloud-user
type: string
ansibleVars:
x-kubernetes-preserve-unknown-fields: true
Expand Down Expand Up @@ -1020,6 +1021,7 @@ spec:
type: object
type: array
managementNetwork:
default: ctlplane
type: string
networkData:
properties:
Expand Down Expand Up @@ -1068,6 +1070,7 @@ spec:
ansiblePort:
type: integer
ansibleUser:
default: cloud-user
type: string
ansibleVars:
x-kubernetes-preserve-unknown-fields: true
Expand Down
64 changes: 10 additions & 54 deletions config/samples/dataplane_v1beta1_openstackdataplanenodeset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,20 @@ spec:
hostName: edpm-compute-0
ansible:
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
networkAttachments:
- ctlplane
nodeTemplate:
networks:
- name: CtlPlane
subnetName: subnet1
defaultRoute: true
- name: InternalApi
subnetName: subnet1
- name: Storage
subnetName: subnet1
- name: Tenant
subnetName: subnet1
ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret
managementNetwork: ctlplane
ansible:
ansibleUser: cloud-admin
ansiblePort: 22
ansibleVars:
service_net_map:
nova_api_network: internal_api
nova_libvirt_network: internal_api
timesync_ntp_servers:
- hostname: pool.ntp.org
# 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] %}
Expand Down Expand Up @@ -86,37 +76,6 @@ spec:
# 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
Expand All @@ -126,7 +85,4 @@ spec:
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

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ spec:
- name: ANSIBLE_FORCE_COLOR
value: "True"
services:
- download-cache
- bootstrap
- download-cache
- configure-network
- validate-network
- install-os
Expand All @@ -27,6 +27,8 @@ spec:
nodes:
edpm-compute-0:
hostName: edpm-compute-0
ansible:
ansibleHost: 192.168.122.100
networkAttachments:
- ctlplane
nodeTemplate:
Expand All @@ -43,18 +45,7 @@ spec:
subnetName: subnet1
managementNetwork: ctlplane
ansible:
ansibleUser: cloud-admin
ansiblePort: 22
ansibleVars:
service_net_map:
nova_api_network: internal_api
nova_libvirt_network: internal_api
timesync_ntp_servers:
- hostname: pool.ntp.org
# 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] %}
Expand Down Expand Up @@ -97,7 +88,4 @@ spec:
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.111.0/24']
# SELinux module
edpm_selinux_mode: enforcing
Loading

0 comments on commit a4eb720

Please sign in to comment.