Skip to content

Commit

Permalink
Merge pull request openstack-k8s-operators#1008 from stuggi/OSPRH-9443
Browse files Browse the repository at this point in the history
[openstackclient] re-create pod when NodeSelector changes
  • Loading branch information
openshift-merge-bot[bot] authored Aug 16, 2024
2 parents 99a1e96 + e8ad1cd commit 031e12a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion controllers/client/openstackclient_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"context"
"errors"
"fmt"
"reflect"
"time"

"github.com/go-logr/logr"
Expand Down Expand Up @@ -342,8 +343,14 @@ func (r *OpenStackClientReconciler) Reconcile(ctx context.Context, req ctrl.Requ
osclient.Name,
errors.New("Config changed recreate pod"), // Specify the error message
)
case !reflect.DeepEqual(osclient.Spec.NodeSelector, instance.Spec.NodeSelector):
// if NodeSelector change force re-create by triggering NewForbidden
return k8s_errors.NewForbidden(
schema.GroupResource{Group: "", Resource: "pods"}, // Specify the group and resource type
osclient.Name,
errors.New("Cannot update Pod spec field - Spec.NodeSelector"), // Specify the error message
)
}

}

osclient.Labels = util.MergeStringMaps(osclient.Labels, clientLabels)
Expand Down

0 comments on commit 031e12a

Please sign in to comment.