Skip to content

Commit

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

[v1.3.x] Make IPSet OSclient owner check more robust
  • Loading branch information
openshift-merge-bot[bot] authored Oct 29, 2024
2 parents 7b930b5 + bdda196 commit bccd75e
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions controllers/openstacknetconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1228,30 +1228,19 @@ func (r *OpenStackNetConfigReconciler) ensureIPReservation(
//
// For backward compatability check if owning object is osClient and set Role to <openstackclient.Role><instance.Name>
//
osClient := &ospdirectorv1beta1.OpenStackClient{}
err := r.Get(ctx, types.NamespacedName{
Name: osIPset.Labels[common.OwnerNameLabelSelector],
Namespace: osIPset.Namespace},
osClient)
if err != nil {
if !k8s_errors.IsNotFound(err) {
cond.Message = fmt.Sprintf("Failed to get %s %s ", osClient.Kind, osIPset.Labels[common.OwnerNameLabelSelector])
cond.Reason = shared.OsClientCondReasonError
cond.Type = shared.CommonCondTypeError
err = common.WrapErrorForObject(cond.Message, instance, err)

return nil, err
for _, ref := range osIPset.GetOwnerReferences() {
if ref.Controller != nil &&
*ref.Controller && ref.Kind == "OpenStackClient" {
roleName = fmt.Sprintf("%s%s", openstackclient.Role, osIPset.Spec.RoleName)
}
} else {
roleName = fmt.Sprintf("%s%s", openstackclient.Role, osIPset.Spec.RoleName)
}

allRoles[roleName] = true

//
// are there new networks added to the CR?
//
err = r.ensureIPs(
err := r.ensureIPs(
instance,
cond,
osNet,
Expand Down

0 comments on commit bccd75e

Please sign in to comment.