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

Commit

Permalink
Update kustomize examples
Browse files Browse the repository at this point in the history
Renaming values to make easier to compose i.e.  replace components with other scenarios

Signed-off-by: Fabricio Aguiar <[email protected]>
  • Loading branch information
fao89 committed Mar 28, 2024
1 parent d755475 commit 6aaedf0
Show file tree
Hide file tree
Showing 38 changed files with 174 additions and 233 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/kustom.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ jobs:
for d in */ ; do
echo "=============== $d ==============="
../bin/kustomize build "$d"
../bin/kustomize build --load-restrictor LoadRestrictionsNone "$d"
done
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: dataplane.openstack.org/v1beta1
kind: OpenStackDataPlaneDeployment
metadata:
name: openstack-edpm
name: edpm-deployment
spec:
nodeSets:
- openstack-edpm
58 changes: 17 additions & 41 deletions config/samples/dataplane_v1beta1_openstackdataplanenodeset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ kind: OpenStackDataPlaneNodeSet
metadata:
name: openstack-edpm
spec:
env:
- name: ANSIBLE_FORCE_COLOR
value: "True"
services:
- bootstrap
- download-cache
Expand Down Expand Up @@ -41,54 +44,27 @@ spec:
nodeTemplate:
ansibleSSHPrivateKeySecret: dataplane-ansible-ssh-private-key-secret
ansible:
ansibleVarsFrom:
- prefix: edpm_
configMapRef:
name: network-config-template
- prefix: neutron_
configMapRef:
name: neutron-edpm
# CHANGEME -- see https://access.redhat.com/solutions/253273
# - prefix: subscription_manager_
# secretRef:
# name: subscription-manager
# - prefix: registry_
# secretRef:
# name: redhat-registry
ansibleVars:
# CHANGEME -- see https://access.redhat.com/solutions/253273
# edpm_bootstrap_command: |
# subscription-manager register --username {{ subscription_manager_username }} --password {{ subscription_manager_password }}
# podman login -u {{ registry_username }} -p {{ registry_password }} registry.redhat.io
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_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
# edpm_nodes_validation
edpm_nodes_validation_validate_controllers_icmp: false
edpm_nodes_validation_validate_gateway_icmp: false
ctlplane_dns_nameservers:
- 192.168.122.1
dns_search_domains: []
gather_facts: false
enable_debug: false
# edpm firewall, change the allowed CIDR if needed
Expand Down
2 changes: 1 addition & 1 deletion docs/assemblies/creating-the-data-plane.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To create and deploy a data plane, you must perform the following tasks:
** CBO is installed and configured for provisioning.
** `BareMetalHosts` registered, inspected, and have the label `app:openstack`.
* You are logged on to a workstation that has access to the RHOCP cluster as a user with `cluster-admin` privileges.
* https://kustomize.io/[kustomize] version 5.0.1 or higher
* https://docs.openshift.com/container-platform/4.14/cli_reference/openshift_cli/getting-started-cli.html#installing-openshift-cli[OpenShift CLI] (oc) 4.14 or higher

include::proc_creating-the-SSH-key-secrets.adoc[leveloffset=+1]

Expand Down
4 changes: 2 additions & 2 deletions docs/assemblies/proc_creating-a-set-of-data-plane-nodes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ Create an `OpenStackDataPlaneNodeSet` CR for each logical grouping of nodes in y

* Pre-provisioned nodes:

kustomize build preprovisioned > openstack-edpm.yaml
oc kustomize --load-restrictor LoadRestrictionsNone preprovisioned > openstack-edpm.yaml

* Bare metal nodes:

kustomize build baremetal > openstack-edpm.yaml
oc kustomize --load-restrictor LoadRestrictionsNone baremetal > openstack-edpm.yaml

+
[NOTE]
Expand Down
8 changes: 4 additions & 4 deletions examples/baremetal/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ replacements:
# OpenStackDataPlaneNodeSet customizations
- source:
kind: DataPlaneConfig
name: edpm-values
name: edpm-baremetal-values
fieldPath: data.nodeset.nodetemplate.ansible.vars.edpm_sshd_allowed_ranges
targets:
- select:
Expand All @@ -25,7 +25,7 @@ replacements:
create: true
- source:
kind: DataPlaneConfig
name: edpm-values
name: edpm-baremetal-values
fieldPath: data.nodeset.baremetalsettemplate
targets:
- select:
Expand All @@ -36,7 +36,7 @@ replacements:
create: true
- source:
kind: DataPlaneConfig
name: edpm-values
name: edpm-baremetal-values
fieldPath: data.preProvisioned
targets:
- select:
Expand All @@ -47,7 +47,7 @@ replacements:
create: true
- source:
kind: DataPlaneConfig
name: edpm-values
name: edpm-baremetal-values
fieldPath: data.nodeset.nodetemplate.networks
targets:
- select:
Expand Down
2 changes: 1 addition & 1 deletion examples/baremetal/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: DataPlaneConfig
metadata:
name: edpm-values
name: edpm-baremetal-values
annotations:
config.kubernetes.io/local-config: "true"
data:
Expand Down
8 changes: 0 additions & 8 deletions examples/base/crs/openstackdataplanedeployment.yaml

This file was deleted.

71 changes: 0 additions & 71 deletions examples/base/crs/openstackdataplanenodeset.yaml

This file was deleted.

31 changes: 31 additions & 0 deletions examples/base/files/nic-config.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
{% 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_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 %}
19 changes: 15 additions & 4 deletions examples/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@ apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

resources:
- crs/openstackdataplanenodeset.yaml
- crs/openstackdataplanedeployment.yaml
- vars/nic-config.yaml
- vars/neutron.yaml
- ../../config/samples/dataplane_v1beta1_openstackdataplanenodeset.yaml
- ../../config/samples/dataplane_v1beta1_openstackdataplanedeployment.yaml

namespace: openstack

configMapGenerator:
- name: network-config-template
files:
- network_config_template=files/nic-config.j2
options:
disableNameSuffixHash: true
- name: neutron-edpm
literals:
- physical_bridge_name=br-ex
- public_interface_name=eth0
options:
disableNameSuffixHash: true

configurations:
- config/nodesetname.yaml
- config/varsfromname.yaml
7 changes: 0 additions & 7 deletions examples/base/vars/neutron.yaml

This file was deleted.

37 changes: 0 additions & 37 deletions examples/base/vars/nic-config.yaml

This file was deleted.

6 changes: 3 additions & 3 deletions examples/bgp/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ kind: Component
namespace: openstack

components:
- ../base
- ../preprovisioned # for baremetal nodes, replace with baremetal

resources:
- values.yaml
Expand All @@ -13,7 +13,7 @@ replacements:
# OpenStackDataPlaneNodeSet customizations
- source:
kind: DataPlaneConfig
name: edpm-values
name: edpm-bgp-values
fieldPath: data.nodeset.nodetemplate.ansible.vars
targets:
- select:
Expand All @@ -24,7 +24,7 @@ replacements:
create: true
- source:
kind: DataPlaneConfig
name: edpm-values
name: edpm-bgp-values
fieldPath: data.nodeset.services
targets:
- select:
Expand Down
2 changes: 1 addition & 1 deletion examples/bgp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: v1
kind: DataPlaneConfig
metadata:
name: edpm-values
name: edpm-bgp-values
annotations:
config.kubernetes.io/local-config: "true"
data:
Expand Down
Loading

0 comments on commit 6aaedf0

Please sign in to comment.