diff --git a/pkg/addonmanager/controllers/agentdeploy/controller.go b/pkg/addonmanager/controllers/agentdeploy/controller.go index 20fa9ab9..2c0ceca9 100644 --- a/pkg/addonmanager/controllers/agentdeploy/controller.go +++ b/pkg/addonmanager/controllers/agentdeploy/controller.go @@ -391,15 +391,6 @@ func (c *addonDeployController) buildDeployManifestWorksFunc(addonWorkBuilder *a }) return nil, nil, err } - if len(objects) == 0 { - meta.SetStatusCondition(&addon.Status.Conditions, metav1.Condition{ - Type: appliedType, - Status: metav1.ConditionTrue, - Reason: addonapiv1alpha1.AddonManifestAppliedReasonManifestsApplied, - Message: "no manifest need to apply", - }) - return nil, nil, nil - } // this is to retrieve the intended mode of the addon. var mode string @@ -425,6 +416,14 @@ func (c *addonDeployController) buildDeployManifestWorksFunc(addonWorkBuilder *a }) return nil, nil, err } + if len(appliedWorks) == 0 { + meta.SetStatusCondition(&addon.Status.Conditions, metav1.Condition{ + Type: appliedType, + Status: metav1.ConditionTrue, + Reason: addonapiv1alpha1.AddonManifestAppliedReasonManifestsApplied, + Message: "no manifest need to apply", + }) + } return appliedWorks, deleteWorks, nil } } diff --git a/pkg/addonmanager/controllers/agentdeploy/hosted_sync_test.go b/pkg/addonmanager/controllers/agentdeploy/hosted_sync_test.go index f2f4dbd0..ca1f504e 100644 --- a/pkg/addonmanager/controllers/agentdeploy/hosted_sync_test.go +++ b/pkg/addonmanager/controllers/agentdeploy/hosted_sync_test.go @@ -237,6 +237,9 @@ func TestHostingReconcile(t *testing.T) { if meta.IsStatusConditionFalse(addOn.Status.Conditions, addonapiv1alpha1.ManagedClusterAddOnHostingManifestApplied) { t.Errorf("Condition Reason is not correct: %v", addOn.Status.Conditions) } + if meta.IsStatusConditionFalse(addOn.Status.Conditions, addonapiv1alpha1.ManagedClusterAddOnManifestApplied) { + t.Errorf("Condition Reason is not correct: %v", addOn.Status.Conditions) + } }, }, {