Skip to content

Commit

Permalink
Fix osconfigenerator for Redis/OVNDBs vips
Browse files Browse the repository at this point in the history
Special Redis on OVNDBs roles are not considered in the
configgenerator when rendering the template. As a result the
required hiera redis_vip was not set

Function lookup() did not find a value for the name 'redis_vip'

This updates the configgenerator to consider Redis and OVNDBs
and have the entries like the following in the rendered
parameter file:

~~~
  OVNDBsVirtualFixedIPs:
    - ip_address: 172.17.0.12
      use_neutron: false
  RedisVirtualFixedIPs:
    - ip_address: 172.17.0.11
      use_neutron: false
~~~
  • Loading branch information
stuggi authored and openshift-cherrypick-robot committed Jan 15, 2024
1 parent a90ad8f commit 8e00d59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
7 changes: 4 additions & 3 deletions controllers/openstackconfiggenerator_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ func (r *OpenStackConfigGeneratorReconciler) Reconcile(ctx context.Context, req
}

// check if osvmset and osbms is in status provisioned
msg, deployed, err := r.verifyNodeResourceStatus(ctx, instance)
msg, deployed, err := r.verifyNodeResourceStatus(ctx, instance, OSPVersion)
if err != nil {
return ctrl.Result{}, err
}
Expand Down Expand Up @@ -655,6 +655,7 @@ func (r *OpenStackConfigGeneratorReconciler) SetupWithManager(mgr ctrl.Manager)
func (r *OpenStackConfigGeneratorReconciler) verifyNodeResourceStatus(
ctx context.Context,
instance *ospdirectorv1beta1.OpenStackConfigGenerator,
ospVersion shared.OSPVersion,
) (string, bool, error) {

msg := ""
Expand All @@ -669,7 +670,7 @@ func (r *OpenStackConfigGeneratorReconciler) verifyNodeResourceStatus(
}

for _, vmset := range vmsetList.Items {
if openstackconfiggenerator.IsRoleIncluded(vmset.Spec.RoleName, instance) {
if openstackconfiggenerator.IsRoleIncluded(vmset.Spec.RoleName, instance, ospVersion) {
if vmset.Status.ProvisioningStatus.State != shared.ProvisioningState(shared.VMSetCondTypeProvisioned) {
msg := fmt.Sprintf("Waiting on OpenStackVMset %s to be provisioned...", vmset.Name)
return msg, false, nil
Expand All @@ -690,7 +691,7 @@ func (r *OpenStackConfigGeneratorReconciler) verifyNodeResourceStatus(
//
// wait for all BMS be provisioned if baremetalhosts for the bms are requested
//
if openstackconfiggenerator.IsRoleIncluded(bmset.Spec.RoleName, instance) {
if openstackconfiggenerator.IsRoleIncluded(bmset.Spec.RoleName, instance, ospVersion) {
if bmset.Status.ProvisioningStatus.State != shared.ProvisioningState(shared.BaremetalSetCondTypeProvisioned) &&
bmset.Status.ProvisioningStatus.State != shared.ProvisioningState(shared.BaremetalSetCondTypeEmpty) {
msg := fmt.Sprintf("Waiting on OpenStackBaremetalSet %s to be provisioned...", bmset.Name)
Expand Down
15 changes: 11 additions & 4 deletions pkg/openstackconfiggenerator/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,16 @@ func createNetworksMap(
}

// IsRoleIncluded - checks if the role exists in the ConfigGenerator Roles set
func IsRoleIncluded(roleName string, instance *ospdirectorv1beta1.OpenStackConfigGenerator) bool {

if len(instance.Spec.Roles) == 0 || roleName == controlplane.Role {
func IsRoleIncluded(roleName string, instance *ospdirectorv1beta1.OpenStackConfigGenerator, ospVersion shared.OSPVersion) bool {

// return for special conditions:
// - if there is no specific role specified in the spec
// - the roleName is one of the special roles for allocated VIPs in ipam for
// - ControlPlane
// - Redis (OSP17.1)
// - OVNDPs (OSP17.1)
if len(instance.Spec.Roles) == 0 || roleName == controlplane.Role ||
(ospVersion == shared.OSPVersion(shared.TemplateVersion17_1) && (roleName == "Redis" || roleName == "OVNDBs")) {
return true
}
for _, r := range instance.Spec.Roles {
Expand Down Expand Up @@ -397,7 +404,7 @@ func createRolesMap(
roleOveride, roleOverrideFound = instance.Spec.TripleoRoleOverride[roleName]
}

if IsRoleIncluded(roleName, instance) || (roleOverrideFound && IsRoleIncluded(roleOveride.RoleName, instance)) {
if IsRoleIncluded(roleName, instance, ospVersion) || (roleOverrideFound && IsRoleIncluded(roleOveride.RoleName, instance, ospVersion)) {
//
// check if role is VM
//
Expand Down

0 comments on commit 8e00d59

Please sign in to comment.