Skip to content

Commit

Permalink
Merge pull request #982 from openshift-cherrypick-robot/cherry-pick-9…
Browse files Browse the repository at this point in the history
…81-to-v1.3.x

[v1.3.x] Fix osconfigenerator for Redis/OVNDBs vips
  • Loading branch information
openshift-merge-bot[bot] authored Jan 15, 2024
2 parents a90ad8f + 8e00d59 commit 4e94c18
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 4e94c18

Please sign in to comment.