Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions pkg/controller/clusterrelocate/clusterrelocate_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,24 @@ func (r *ReconcileClusterRelocate) reconcileNoSingleMatch(cd *hivev1.ClusterDepl
func (r *ReconcileClusterRelocate) relocate(cd *hivev1.ClusterDeployment, relocator *hivev1.ClusterRelocate, logger log.FieldLogger) error {
logger = logger.WithField("clusterRelocate", relocator.Name)

if cd.Spec.ManageDNS {
if conds, changed := controllerutils.SetClusterDeploymentConditionWithChangeCheck(
cd.Status.Conditions,
hivev1.RelocationFailedCondition,
corev1.ConditionTrue,
"ManagedDNSUnsupported",
"relocating a ClusterDeployment that used managed DNS is unsupported",
controllerutils.UpdateConditionIfReasonOrMessageChange,
); changed {
cd.Status.Conditions = conds
if err := r.Status().Update(context.Background(), cd); err != nil {
logger.WithError(err).Log(controllerutils.LogLevel(err), "could not update condition")
return errors.Wrap(err, "could not update condition")
}
}
return nil
}

if _, relocated := cd.Annotations[constants.RelocatedAnnotation]; !relocated {
if cd.Annotations[constants.RelocatingAnnotation] != relocator.Name {
if cd.Annotations == nil {
Expand Down
11 changes: 11 additions & 0 deletions pkg/controller/clusterrelocate/clusterrelocate_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,17 @@ func TestReconcileClusterRelocate_Reconcile_Movement(t *testing.T) {
crBuilder.Build(testcr.WithClusterDeploymentSelector("other-key", "other-value")),
},
},
{
name: "managed DNS",
cd: cdBuilder.Build(
func(cd *hivev1.ClusterDeployment) {
cd.Spec.ManageDNS = true
},
),
srcResources: []runtime.Object{
crBuilder.Build(testcr.WithClusterDeploymentSelector("other-key", "other-value")),
},
},
}
for _, tc := range cases {
t.Run(tc.name, func(t *testing.T) {
Expand Down