From 2617c7f1dd0efef102fe4ecfa88077b396d82373 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Mon, 2 Dec 2024 15:18:27 +0300 Subject: [PATCH 01/18] #2219 more checks --- pkg/resource/domain/hooks.go | 40 ++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/pkg/resource/domain/hooks.go b/pkg/resource/domain/hooks.go index 6d7e3e5..f11d7fb 100644 --- a/pkg/resource/domain/hooks.go +++ b/pkg/resource/domain/hooks.go @@ -16,6 +16,7 @@ package domain import ( "context" "errors" + "github.com/aws-controllers-k8s/opensearchservice-controller/apis/v1alpha1" ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" ackcompare "github.com/aws-controllers-k8s/runtime/pkg/compare" @@ -179,6 +180,7 @@ func (rm *resourceManager) customUpdateDomain(ctx context.Context, desired, late } ko.Spec.AutoTuneOptions = &v1alpha1.AutoTuneOptionsInput{ DesiredState: resp.DomainConfig.AutoTuneOptions.Options.DesiredState, + UseOffPeakWindow: resp.DomainConfig.AutoTuneOptions.Options.UseOffPeakWindow, MaintenanceSchedules: maintSchedules, } } else { @@ -198,17 +200,18 @@ func (rm *resourceManager) customUpdateDomain(ctx context.Context, desired, late } } ko.Spec.ClusterConfig = &v1alpha1.ClusterConfig{ - ColdStorageOptions: csOptions, - DedicatedMasterCount: resp.DomainConfig.ClusterConfig.Options.DedicatedMasterCount, - DedicatedMasterEnabled: resp.DomainConfig.ClusterConfig.Options.DedicatedMasterEnabled, - DedicatedMasterType: resp.DomainConfig.ClusterConfig.Options.DedicatedMasterType, - InstanceCount: resp.DomainConfig.ClusterConfig.Options.InstanceCount, - InstanceType: resp.DomainConfig.ClusterConfig.Options.InstanceType, - WarmCount: resp.DomainConfig.ClusterConfig.Options.WarmCount, - WarmEnabled: resp.DomainConfig.ClusterConfig.Options.WarmEnabled, - WarmType: resp.DomainConfig.ClusterConfig.Options.WarmType, - ZoneAwarenessConfig: zaConfig, - ZoneAwarenessEnabled: resp.DomainConfig.ClusterConfig.Options.ZoneAwarenessEnabled, + ColdStorageOptions: csOptions, + DedicatedMasterCount: resp.DomainConfig.ClusterConfig.Options.DedicatedMasterCount, + DedicatedMasterEnabled: resp.DomainConfig.ClusterConfig.Options.DedicatedMasterEnabled, + DedicatedMasterType: resp.DomainConfig.ClusterConfig.Options.DedicatedMasterType, + InstanceCount: resp.DomainConfig.ClusterConfig.Options.InstanceCount, + InstanceType: resp.DomainConfig.ClusterConfig.Options.InstanceType, + WarmCount: resp.DomainConfig.ClusterConfig.Options.WarmCount, + WarmEnabled: resp.DomainConfig.ClusterConfig.Options.WarmEnabled, + WarmType: resp.DomainConfig.ClusterConfig.Options.WarmType, + ZoneAwarenessConfig: zaConfig, + ZoneAwarenessEnabled: resp.DomainConfig.ClusterConfig.Options.ZoneAwarenessEnabled, + MultiAZWithStandbyEnabled: resp.DomainConfig.ClusterConfig.Options.MultiAZWithStandbyEnabled, } } else { ko.Spec.ClusterConfig = nil @@ -258,6 +261,11 @@ func (rm *resourceManager) customUpdateDomain(ctx context.Context, desired, late } else { ko.Spec.EngineVersion = nil } + if resp.DomainConfig.IPAddressType != nil { + ko.Spec.IPAddressType = resp.DomainConfig.IPAddressType.Options + } else { + ko.Spec.IPAddressType = nil + } if resp.DomainConfig.NodeToNodeEncryptionOptions != nil { ko.Spec.NodeToNodeEncryptionOptions = &v1alpha1.NodeToNodeEncryptionOptions{ Enabled: resp.DomainConfig.NodeToNodeEncryptionOptions.Options.Enabled, @@ -370,6 +378,9 @@ func (rm *resourceManager) newCustomUpdateRequestPayload( if desired.ko.Spec.AutoTuneOptions.DesiredState != nil { f3.SetDesiredState(*desired.ko.Spec.AutoTuneOptions.DesiredState) } + if desired.ko.Spec.AutoTuneOptions.UseOffPeakWindow != nil { + f3.SetUseOffPeakWindow(*desired.ko.Spec.AutoTuneOptions.UseOffPeakWindow) + } if desired.ko.Spec.AutoTuneOptions.MaintenanceSchedules != nil { f3f1 := []*svcsdk.AutoTuneMaintenanceSchedule{} for _, f3f1iter := range desired.ko.Spec.AutoTuneOptions.MaintenanceSchedules { @@ -440,6 +451,9 @@ func (rm *resourceManager) newCustomUpdateRequestPayload( if desired.ko.Spec.ClusterConfig.ZoneAwarenessEnabled != nil { f4.SetZoneAwarenessEnabled(*desired.ko.Spec.ClusterConfig.ZoneAwarenessEnabled) } + if desired.ko.Spec.ClusterConfig.MultiAZWithStandbyEnabled != nil { + f4.SetMultiAZWithStandbyEnabled(*desired.ko.Spec.ClusterConfig.MultiAZWithStandbyEnabled) + } res.SetClusterConfig(f4) } @@ -557,5 +571,9 @@ func (rm *resourceManager) newCustomUpdateRequestPayload( res.SetVPCOptions(f14) } + if desired.ko.Spec.IPAddressType != nil && delta.DifferentAt("Spec.IPAddressType") { + res.SetIPAddressType(*desired.ko.Spec.IPAddressType) + } + return res, nil } From e60e8fe0b4eff17a19207538cd25a26ec7488117 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Tue, 3 Dec 2024 10:22:29 +0300 Subject: [PATCH 02/18] #2219 add missing fields during cluster modifications --- pkg/resource/domain/hooks.go | 77 ++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/pkg/resource/domain/hooks.go b/pkg/resource/domain/hooks.go index f11d7fb..cbb3ca8 100644 --- a/pkg/resource/domain/hooks.go +++ b/pkg/resource/domain/hooks.go @@ -273,6 +273,41 @@ func (rm *resourceManager) customUpdateDomain(ctx context.Context, desired, late } else { ko.Spec.NodeToNodeEncryptionOptions = nil } + if resp.DomainConfig.SoftwareUpdateOptions != nil { + ko.Spec.SoftwareUpdateOptions = &v1alpha1.SoftwareUpdateOptions{ + AutoSoftwareUpdateEnabled: resp.DomainConfig.SoftwareUpdateOptions.Options.AutoSoftwareUpdateEnabled, + } + } else { + ko.Spec.SoftwareUpdateOptions = nil + } + if resp.DomainConfig.AIMLOptions != nil && resp.DomainConfig.AIMLOptions.Options.NaturalLanguageQueryGenerationOptions != nil { + if resp.DomainConfig.AIMLOptions.Options.NaturalLanguageQueryGenerationOptions != nil { + ko.Spec.AIMLOptions = &v1alpha1.AIMLOptionsInput{ + NATuralLanguageQueryGenerationOptions: &v1alpha1.NATuralLanguageQueryGenerationOptionsInput{ + DesiredState: resp.DomainConfig.AIMLOptions.Options.NaturalLanguageQueryGenerationOptions.DesiredState, + }, + } + } + } else { + ko.Spec.AIMLOptions = nil + } + if resp.DomainConfig.OffPeakWindowOptions != nil && resp.DomainConfig.OffPeakWindowOptions.Options != nil { + var offPeakWindow *v1alpha1.OffPeakWindow + if resp.DomainConfig.OffPeakWindowOptions.Options.OffPeakWindow != nil { + offPeakWindow = &v1alpha1.OffPeakWindow{ + WindowStartTime: &v1alpha1.WindowStartTime{ + Hours: resp.DomainConfig.OffPeakWindowOptions.Options.OffPeakWindow.WindowStartTime.Hours, + Minutes: resp.DomainConfig.OffPeakWindowOptions.Options.OffPeakWindow.WindowStartTime.Minutes, + }, + } + } + ko.Spec.OffPeakWindowOptions = &v1alpha1.OffPeakWindowOptions{ + Enabled: resp.DomainConfig.OffPeakWindowOptions.Options.Enabled, + OffPeakWindow: offPeakWindow, + } + } else { + ko.Spec.OffPeakWindowOptions = nil + } rm.setStatusDefaults(ko) @@ -575,5 +610,47 @@ func (rm *resourceManager) newCustomUpdateRequestPayload( res.SetIPAddressType(*desired.ko.Spec.IPAddressType) } + if desired.ko.Spec.SoftwareUpdateOptions != nil && delta.DifferentAt("Spec.SoftwareUpdateOptions") { + f15 := &svcsdk.SoftwareUpdateOptions{} + if desired.ko.Spec.SoftwareUpdateOptions.AutoSoftwareUpdateEnabled != nil { + f15.SetAutoSoftwareUpdateEnabled(*desired.ko.Spec.SoftwareUpdateOptions.AutoSoftwareUpdateEnabled) + } + res.SetSoftwareUpdateOptions(f15) + } + + if desired.ko.Spec.AIMLOptions != nil && delta.DifferentAt("Spec.AIMLOptions") { + f16 := &svcsdk.AIMLOptionsInput_{} + if desired.ko.Spec.AIMLOptions.NATuralLanguageQueryGenerationOptions != nil { + f16f0 := &svcsdk.NaturalLanguageQueryGenerationOptionsInput_{} + if desired.ko.Spec.AIMLOptions.NATuralLanguageQueryGenerationOptions.DesiredState != nil { + f16f0.SetDesiredState(*desired.ko.Spec.AIMLOptions.NATuralLanguageQueryGenerationOptions.DesiredState) + } + f16.SetNaturalLanguageQueryGenerationOptions(f16f0) + } + res.SetAIMLOptions(f16) + } + + if desired.ko.Spec.OffPeakWindowOptions != nil && delta.DifferentAt("Spec.OffPeakWindowOptions") { + f17 := &svcsdk.OffPeakWindowOptions{} + if desired.ko.Spec.OffPeakWindowOptions.Enabled != nil { + f17.SetEnabled(*desired.ko.Spec.OffPeakWindowOptions.Enabled) + } + if desired.ko.Spec.OffPeakWindowOptions.OffPeakWindow != nil { + f17f1 := &svcsdk.OffPeakWindow{} + if desired.ko.Spec.OffPeakWindowOptions.OffPeakWindow.WindowStartTime != nil { + f17f1f1 := &svcsdk.WindowStartTime{} + if desired.ko.Spec.OffPeakWindowOptions.OffPeakWindow.WindowStartTime.Hours != nil { + f17f1f1.SetHours(*desired.ko.Spec.OffPeakWindowOptions.OffPeakWindow.WindowStartTime.Hours) + } + if desired.ko.Spec.OffPeakWindowOptions.OffPeakWindow.WindowStartTime.Minutes != nil { + f17f1f1.SetMinutes(*desired.ko.Spec.OffPeakWindowOptions.OffPeakWindow.WindowStartTime.Minutes) + } + f17f1.SetWindowStartTime(f17f1f1) + } + f17.SetOffPeakWindow(f17f1) + } + res.SetOffPeakWindowOptions(f17) + } + return res, nil } From 706a4db31589a45311255deb034404ed844fb8a0 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Thu, 9 Jan 2025 16:41:46 +0300 Subject: [PATCH 03/18] #2219 remove duplicated nil check --- pkg/resource/domain/hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/resource/domain/hooks.go b/pkg/resource/domain/hooks.go index cbb3ca8..76df4c2 100644 --- a/pkg/resource/domain/hooks.go +++ b/pkg/resource/domain/hooks.go @@ -280,7 +280,7 @@ func (rm *resourceManager) customUpdateDomain(ctx context.Context, desired, late } else { ko.Spec.SoftwareUpdateOptions = nil } - if resp.DomainConfig.AIMLOptions != nil && resp.DomainConfig.AIMLOptions.Options.NaturalLanguageQueryGenerationOptions != nil { + if resp.DomainConfig.AIMLOptions != nil { if resp.DomainConfig.AIMLOptions.Options.NaturalLanguageQueryGenerationOptions != nil { ko.Spec.AIMLOptions = &v1alpha1.AIMLOptionsInput{ NATuralLanguageQueryGenerationOptions: &v1alpha1.NATuralLanguageQueryGenerationOptionsInput{ From 92fcaf7114e235bb06a07436f713732e35f4820b Mon Sep 17 00:00:00 2001 From: acharviakou Date: Thu, 9 Jan 2025 16:44:10 +0300 Subject: [PATCH 04/18] #2219 remove duplicated nil check --- pkg/resource/domain/hooks.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/resource/domain/hooks.go b/pkg/resource/domain/hooks.go index 76df4c2..ae3e451 100644 --- a/pkg/resource/domain/hooks.go +++ b/pkg/resource/domain/hooks.go @@ -280,7 +280,7 @@ func (rm *resourceManager) customUpdateDomain(ctx context.Context, desired, late } else { ko.Spec.SoftwareUpdateOptions = nil } - if resp.DomainConfig.AIMLOptions != nil { + if resp.DomainConfig.AIMLOptions != nil && resp.DomainConfig.AIMLOptions.Options != nil { if resp.DomainConfig.AIMLOptions.Options.NaturalLanguageQueryGenerationOptions != nil { ko.Spec.AIMLOptions = &v1alpha1.AIMLOptionsInput{ NATuralLanguageQueryGenerationOptions: &v1alpha1.NATuralLanguageQueryGenerationOptionsInput{ From 2b9fbe26544dc792cd70c0b8677a357417f5a3d1 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Mon, 13 Jan 2025 18:16:54 +0300 Subject: [PATCH 05/18] #2219 update e2e tests --- test/e2e/tests/test_domain.py | 55 +++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index f8972fd..672f289 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -281,6 +281,61 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc assert 'status' in cr domain.assert_endpoint(cr) + # now we will modify the engine version to test upgrades + # similar to creating a new domain, this takes a long time, often 20+ minutes + updates = { + "spec": { + "AIMLOptions": { + "naturalLanguageQueryGenerationOptions": { + "desiredState": "DISABLED" + } + }, + "AutoTuneOptions": { + "DesiredState": "DISABLED", + "UseOffPeakWindow": False + }, + "ClusterConfig": { + "MultiAZWithStandbyEnabled": False + }, + "IPAddressType": "ipv4", + "OffPeakWindowOptions": { + "enabled": False, + "offPeakWindow": { + "windowStartTime": { + "hours": 22, + "minutes": 30 + } + } + }, + "SoftwareUpdateOptions": { + "autoSoftwareUpdateEnabled": True + }, + } + } + k8s.patch_custom_resource(ref, updates) + + # wait for 15 minutes, it's always going to take at least this long + time.sleep(MODIFY_WAIT_AFTER_SECONDS) + # now loop to see if it's done, with a max elapsed time so the test doesn't run forever + count = 0 + while count < 30: + count += 1 + latest = domain.get(resource.name) + assert latest is not None + if latest['DomainStatus']['UpgradeProcessing'] is True: + time.sleep(CHECK_STATUS_WAIT_SECONDS) + continue + else: + assert latest['DomainStatus']['AIMLOptions']['NaturalLanguageQueryGenerationOptions']['CurrentState'] == "DISABLED" + assert latest['DomainStatus']['AutoTuneOptions']['State'] == "DISABLED" + assert latest['DomainStatus']['AutoTuneOptions']['UseOffPeakWindow'] is False + assert latest['DomainStatus']['ClusterConfig']['MultiAZWithStandbyEnabled'] is False + assert latest['DomainStatus']['IPAddressType'] == "ipv4" + assert latest['DomainStatus']['OffPeakWindowOptions']["Enabled"] is False + assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Hours"] == 22 + assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Minutes"] == 30 + break + def test_create_delete_es_2d3m_multi_az_vpc_2_subnet7_9(self, es_2d3m_multi_az_vpc_2_subnet7_9_domain): ref, resource = es_2d3m_multi_az_vpc_2_subnet7_9_domain From 0098533faf574555b4bccf0d1ff0dc50d1b0bbfa Mon Sep 17 00:00:00 2001 From: acharviakou Date: Tue, 14 Jan 2025 09:48:03 +0300 Subject: [PATCH 06/18] #2219 update e2e tests --- test/e2e/tests/test_domain.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index 672f289..cdf7f28 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -281,15 +281,10 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc assert 'status' in cr domain.assert_endpoint(cr) - # now we will modify the engine version to test upgrades - # similar to creating a new domain, this takes a long time, often 20+ minutes + # now we will modify some cluster parameters to test updates + # similar to creating/upgrading domain, this takes a long time, often 20+ minutes updates = { "spec": { - "AIMLOptions": { - "naturalLanguageQueryGenerationOptions": { - "desiredState": "DISABLED" - } - }, "AutoTuneOptions": { "DesiredState": "DISABLED", "UseOffPeakWindow": False @@ -297,7 +292,6 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc "ClusterConfig": { "MultiAZWithStandbyEnabled": False }, - "IPAddressType": "ipv4", "OffPeakWindowOptions": { "enabled": False, "offPeakWindow": { @@ -326,11 +320,9 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc time.sleep(CHECK_STATUS_WAIT_SECONDS) continue else: - assert latest['DomainStatus']['AIMLOptions']['NaturalLanguageQueryGenerationOptions']['CurrentState'] == "DISABLED" assert latest['DomainStatus']['AutoTuneOptions']['State'] == "DISABLED" assert latest['DomainStatus']['AutoTuneOptions']['UseOffPeakWindow'] is False assert latest['DomainStatus']['ClusterConfig']['MultiAZWithStandbyEnabled'] is False - assert latest['DomainStatus']['IPAddressType'] == "ipv4" assert latest['DomainStatus']['OffPeakWindowOptions']["Enabled"] is False assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Hours"] == 22 assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Minutes"] == 30 From 242e5b6e7943720f047e08a0cab9ec6d9c0463f1 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Wed, 15 Jan 2025 10:15:45 +0300 Subject: [PATCH 07/18] #2219 fix test --- test/e2e/tests/test_domain.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index cdf7f28..c994b40 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -286,7 +286,6 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc updates = { "spec": { "AutoTuneOptions": { - "DesiredState": "DISABLED", "UseOffPeakWindow": False }, "ClusterConfig": { @@ -304,7 +303,7 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc "SoftwareUpdateOptions": { "autoSoftwareUpdateEnabled": True }, - } + }, } k8s.patch_custom_resource(ref, updates) @@ -320,7 +319,6 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc time.sleep(CHECK_STATUS_WAIT_SECONDS) continue else: - assert latest['DomainStatus']['AutoTuneOptions']['State'] == "DISABLED" assert latest['DomainStatus']['AutoTuneOptions']['UseOffPeakWindow'] is False assert latest['DomainStatus']['ClusterConfig']['MultiAZWithStandbyEnabled'] is False assert latest['DomainStatus']['OffPeakWindowOptions']["Enabled"] is False From 60bea5ef6235a599fa2e7d484e65c954291fbd4a Mon Sep 17 00:00:00 2001 From: acharviakou Date: Wed, 15 Jan 2025 11:45:30 +0300 Subject: [PATCH 08/18] #2219 fix test --- test/e2e/tests/test_domain.py | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index c994b40..241303d 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -281,8 +281,7 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc assert 'status' in cr domain.assert_endpoint(cr) - # now we will modify some cluster parameters to test updates - # similar to creating/upgrading domain, this takes a long time, often 20+ minutes + # modify some cluster parameters to test updates updates = { "spec": { "AutoTuneOptions": { @@ -306,25 +305,15 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc }, } k8s.patch_custom_resource(ref, updates) + k8s.wait_on_condition(ref, condition.CONDITION_TYPE_RESOURCE_SYNCED) + latest = domain.get(resource.name) + print("latest:", latest) - # wait for 15 minutes, it's always going to take at least this long - time.sleep(MODIFY_WAIT_AFTER_SECONDS) - # now loop to see if it's done, with a max elapsed time so the test doesn't run forever - count = 0 - while count < 30: - count += 1 - latest = domain.get(resource.name) - assert latest is not None - if latest['DomainStatus']['UpgradeProcessing'] is True: - time.sleep(CHECK_STATUS_WAIT_SECONDS) - continue - else: - assert latest['DomainStatus']['AutoTuneOptions']['UseOffPeakWindow'] is False - assert latest['DomainStatus']['ClusterConfig']['MultiAZWithStandbyEnabled'] is False - assert latest['DomainStatus']['OffPeakWindowOptions']["Enabled"] is False - assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Hours"] == 22 - assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Minutes"] == 30 - break + assert latest['DomainStatus']['AutoTuneOptions']['UseOffPeakWindow'] is False + assert latest['DomainStatus']['ClusterConfig']['MultiAZWithStandbyEnabled'] is False + assert latest['DomainStatus']['OffPeakWindowOptions']["Enabled"] is False + assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Hours"] == 22 + assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Minutes"] == 30 def test_create_delete_es_2d3m_multi_az_vpc_2_subnet7_9(self, es_2d3m_multi_az_vpc_2_subnet7_9_domain): ref, resource = es_2d3m_multi_az_vpc_2_subnet7_9_domain From fe5102193679ca226efa0ad458db718ce2809137 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Wed, 15 Jan 2025 13:13:05 +0300 Subject: [PATCH 09/18] #2219 fix test --- test/e2e/tests/test_domain.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index 241303d..d628df0 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -305,7 +305,8 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc }, } k8s.patch_custom_resource(ref, updates) - k8s.wait_on_condition(ref, condition.CONDITION_TYPE_RESOURCE_SYNCED) + time.sleep(CHECK_STATUS_WAIT_SECONDS) + assert k8s.wait_on_condition(ref, condition.CONDITION_TYPE_RESOURCE_SYNCED, "True", wait_periods=20) latest = domain.get(resource.name) print("latest:", latest) From 9d433d0a6b9bed724bfde5e2d20eacfcc40475aa Mon Sep 17 00:00:00 2001 From: acharviakou Date: Wed, 15 Jan 2025 14:23:54 +0300 Subject: [PATCH 10/18] #2219 fix test --- test/e2e/tests/test_domain.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index d628df0..cb23a5a 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -291,7 +291,6 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc "MultiAZWithStandbyEnabled": False }, "OffPeakWindowOptions": { - "enabled": False, "offPeakWindow": { "windowStartTime": { "hours": 22, @@ -312,7 +311,6 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc assert latest['DomainStatus']['AutoTuneOptions']['UseOffPeakWindow'] is False assert latest['DomainStatus']['ClusterConfig']['MultiAZWithStandbyEnabled'] is False - assert latest['DomainStatus']['OffPeakWindowOptions']["Enabled"] is False assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Hours"] == 22 assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Minutes"] == 30 From fb6ae548b5d0de027e2d06c817335bc239078e02 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Wed, 15 Jan 2025 16:45:57 +0300 Subject: [PATCH 11/18] #2219 fix test --- test/e2e/tests/test_domain.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index cb23a5a..2749fdb 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -300,8 +300,8 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc }, "SoftwareUpdateOptions": { "autoSoftwareUpdateEnabled": True - }, - }, + } + } } k8s.patch_custom_resource(ref, updates) time.sleep(CHECK_STATUS_WAIT_SECONDS) From 68b7d78baf782629bf3f97b941c51c42a63c282b Mon Sep 17 00:00:00 2001 From: acharviakou Date: Thu, 16 Jan 2025 10:46:59 +0300 Subject: [PATCH 12/18] #2219 fix test --- test/e2e/tests/test_domain.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index 2749fdb..efe6d7b 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -291,28 +291,31 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc "MultiAZWithStandbyEnabled": False }, "OffPeakWindowOptions": { - "offPeakWindow": { - "windowStartTime": { - "hours": 22, - "minutes": 30 + "Enabled": True, + "OffPeakWindow": { + "WindowStartTime": { + "Hours": 23, + "Minutes": 30 } } }, "SoftwareUpdateOptions": { - "autoSoftwareUpdateEnabled": True + "AutoSoftwareUpdateEnabled": True } } } k8s.patch_custom_resource(ref, updates) time.sleep(CHECK_STATUS_WAIT_SECONDS) - assert k8s.wait_on_condition(ref, condition.CONDITION_TYPE_RESOURCE_SYNCED, "True", wait_periods=20) + assert k8s.wait_on_condition(ref, condition.CONDITION_TYPE_RESOURCE_SYNCED, "True", wait_periods=10) latest = domain.get(resource.name) print("latest:", latest) assert latest['DomainStatus']['AutoTuneOptions']['UseOffPeakWindow'] is False assert latest['DomainStatus']['ClusterConfig']['MultiAZWithStandbyEnabled'] is False - assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Hours"] == 22 + assert latest['DomainStatus']['OffPeakWindowOptions']["Enabled"] is True + assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Hours"] == 23 assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Minutes"] == 30 + assert latest['DomainStatus']['SoftwareUpdateOptions']["AutoSoftwareUpdateEnabled"] is True def test_create_delete_es_2d3m_multi_az_vpc_2_subnet7_9(self, es_2d3m_multi_az_vpc_2_subnet7_9_domain): ref, resource = es_2d3m_multi_az_vpc_2_subnet7_9_domain From 909ed31be9468e5d7d60f3c1b8cf1c7e9b617425 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Thu, 16 Jan 2025 16:01:12 +0300 Subject: [PATCH 13/18] #2219 fix tests --- test/e2e/tests/test_domain.py | 43 +++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index efe6d7b..35e5304 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -283,27 +283,30 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc # modify some cluster parameters to test updates updates = { - "spec": { - "AutoTuneOptions": { - "UseOffPeakWindow": False - }, - "ClusterConfig": { - "MultiAZWithStandbyEnabled": False - }, - "OffPeakWindowOptions": { - "Enabled": True, - "OffPeakWindow": { - "WindowStartTime": { - "Hours": 23, - "Minutes": 30 - } - } - }, - "SoftwareUpdateOptions": { - "AutoSoftwareUpdateEnabled": True - } - } + "spec": {"AutoTuneOptions": {"UseOffPeakWindow": True}}, } + # updates = { + # "spec": { + # "AutoTuneOptions": { + # "UseOffPeakWindow": False + # }, + # "ClusterConfig": { + # "MultiAZWithStandbyEnabled": False + # }, + # "OffPeakWindowOptions": { + # "Enabled": True, + # "OffPeakWindow": { + # "WindowStartTime": { + # "Hours": 23, + # "Minutes": 30 + # } + # } + # }, + # "SoftwareUpdateOptions": { + # "AutoSoftwareUpdateEnabled": True + # } + # } + # } k8s.patch_custom_resource(ref, updates) time.sleep(CHECK_STATUS_WAIT_SECONDS) assert k8s.wait_on_condition(ref, condition.CONDITION_TYPE_RESOURCE_SYNCED, "True", wait_periods=10) From f01bb051eb026c7c9140846bd3647bb4951afda1 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Thu, 16 Jan 2025 18:22:40 +0300 Subject: [PATCH 14/18] #2219 fix tests --- test/e2e/tests/test_domain.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index 35e5304..b8840b2 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -283,7 +283,7 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc # modify some cluster parameters to test updates updates = { - "spec": {"AutoTuneOptions": {"UseOffPeakWindow": True}}, + "spec": {"autoTuneOptions": {"useOffPeakWindow": True}}, } # updates = { # "spec": { From bedcc6c1b98bc1dc81816e7fb4d4fe2d8d69bb48 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Thu, 16 Jan 2025 19:52:12 +0300 Subject: [PATCH 15/18] #2219 fix tests --- test/e2e/tests/test_domain.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index b8840b2..4e138dd 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -283,7 +283,7 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc # modify some cluster parameters to test updates updates = { - "spec": {"autoTuneOptions": {"useOffPeakWindow": True}}, + "spec": {"softwareUpdateOptions": {"autoSoftwareUpdateEnabled": True}}, } # updates = { # "spec": { @@ -309,15 +309,16 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc # } k8s.patch_custom_resource(ref, updates) time.sleep(CHECK_STATUS_WAIT_SECONDS) + print("after check wait:", domain.get(resource.name)) assert k8s.wait_on_condition(ref, condition.CONDITION_TYPE_RESOURCE_SYNCED, "True", wait_periods=10) latest = domain.get(resource.name) print("latest:", latest) - assert latest['DomainStatus']['AutoTuneOptions']['UseOffPeakWindow'] is False - assert latest['DomainStatus']['ClusterConfig']['MultiAZWithStandbyEnabled'] is False - assert latest['DomainStatus']['OffPeakWindowOptions']["Enabled"] is True - assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Hours"] == 23 - assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Minutes"] == 30 + # assert latest['DomainStatus']['AutoTuneOptions']['UseOffPeakWindow'] is False + # assert latest['DomainStatus']['ClusterConfig']['MultiAZWithStandbyEnabled'] is False + # assert latest['DomainStatus']['OffPeakWindowOptions']["Enabled"] is True + # assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Hours"] == 23 + # assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Minutes"] == 30 assert latest['DomainStatus']['SoftwareUpdateOptions']["AutoSoftwareUpdateEnabled"] is True def test_create_delete_es_2d3m_multi_az_vpc_2_subnet7_9(self, es_2d3m_multi_az_vpc_2_subnet7_9_domain): From 6254018a31d2dac61e02ce8e52bba9eaa921f891 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Thu, 16 Jan 2025 21:10:21 +0300 Subject: [PATCH 16/18] #2219 fix tests --- test/e2e/tests/test_domain.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index 4e138dd..31e6647 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -280,6 +280,7 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc assert cr is not None assert 'status' in cr domain.assert_endpoint(cr) + print("before:", domain.get(resource.name)) # modify some cluster parameters to test updates updates = { @@ -310,7 +311,7 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc k8s.patch_custom_resource(ref, updates) time.sleep(CHECK_STATUS_WAIT_SECONDS) print("after check wait:", domain.get(resource.name)) - assert k8s.wait_on_condition(ref, condition.CONDITION_TYPE_RESOURCE_SYNCED, "True", wait_periods=10) + # assert k8s.wait_on_condition(ref, condition.CONDITION_TYPE_RESOURCE_SYNCED, "True", wait_periods=10) latest = domain.get(resource.name) print("latest:", latest) From c6bff120603dc21c9484cca376392e9d18ae7921 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Fri, 17 Jan 2025 08:48:49 +0300 Subject: [PATCH 17/18] #2219 fix tests --- test/e2e/tests/test_domain.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/test/e2e/tests/test_domain.py b/test/e2e/tests/test_domain.py index 31e6647..a219a07 100644 --- a/test/e2e/tests/test_domain.py +++ b/test/e2e/tests/test_domain.py @@ -284,7 +284,20 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc # modify some cluster parameters to test updates updates = { - "spec": {"softwareUpdateOptions": {"autoSoftwareUpdateEnabled": True}}, + "spec": { + "softwareUpdateOptions": { + "autoSoftwareUpdateEnabled": True + }, + "offPeakWindowOptions": { + "enabled": True, + "offPeakWindow": { + "windowStartTime": { + "hours": 23, + "minutes": 30 + } + } + } + }, } # updates = { # "spec": { @@ -311,15 +324,15 @@ def test_create_delete_es_2d3m_multi_az_no_vpc_7_9(self, es_2d3m_multi_az_no_vpc k8s.patch_custom_resource(ref, updates) time.sleep(CHECK_STATUS_WAIT_SECONDS) print("after check wait:", domain.get(resource.name)) - # assert k8s.wait_on_condition(ref, condition.CONDITION_TYPE_RESOURCE_SYNCED, "True", wait_periods=10) + assert k8s.wait_on_condition(ref, "ACK.ResourceSynced", "True", wait_periods=30) latest = domain.get(resource.name) print("latest:", latest) # assert latest['DomainStatus']['AutoTuneOptions']['UseOffPeakWindow'] is False # assert latest['DomainStatus']['ClusterConfig']['MultiAZWithStandbyEnabled'] is False - # assert latest['DomainStatus']['OffPeakWindowOptions']["Enabled"] is True - # assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Hours"] == 23 - # assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Minutes"] == 30 + assert latest['DomainStatus']['OffPeakWindowOptions']["Enabled"] is True + assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Hours"] == 23 + assert latest['DomainStatus']['OffPeakWindowOptions']["OffPeakWindow"]["WindowStartTime"]["Minutes"] == 30 assert latest['DomainStatus']['SoftwareUpdateOptions']["AutoSoftwareUpdateEnabled"] is True def test_create_delete_es_2d3m_multi_az_vpc_2_subnet7_9(self, es_2d3m_multi_az_vpc_2_subnet7_9_domain): From 5d3c4c65fbb049ec24da1a15420a0a5ae4e0c250 Mon Sep 17 00:00:00 2001 From: acharviakou Date: Fri, 31 Jan 2025 10:50:31 +0300 Subject: [PATCH 18/18] #2219 handle autotune options --- pkg/resource/domain/descriptor.go | 10 +++++----- pkg/resource/domain/hooks.go | 15 ++++++++++++++ pkg/resource/domain/sdk.go | 20 +++++++++++++++++++ .../domain/sdk_create_post_set_output.go.tpl | 10 ++++++++++ .../sdk_read_one_post_set_output.go.tpl | 10 ++++++++++ 5 files changed, 60 insertions(+), 5 deletions(-) diff --git a/pkg/resource/domain/descriptor.go b/pkg/resource/domain/descriptor.go index 2bcfa1b..0f93c98 100644 --- a/pkg/resource/domain/descriptor.go +++ b/pkg/resource/domain/descriptor.go @@ -28,7 +28,7 @@ import ( ) const ( - finalizerString = "finalizers.opensearchservice.services.k8s.aws/Domain" + FinalizerString = "finalizers.opensearchservice.services.k8s.aws/Domain" ) var ( @@ -88,8 +88,8 @@ func (d *resourceDescriptor) IsManaged( // https://github.com/kubernetes-sigs/controller-runtime/issues/994 is // fixed. This should be able to be: // - // return k8sctrlutil.ContainsFinalizer(obj, finalizerString) - return containsFinalizer(obj, finalizerString) + // return k8sctrlutil.ContainsFinalizer(obj, FinalizerString) + return containsFinalizer(obj, FinalizerString) } // Remove once https://github.com/kubernetes-sigs/controller-runtime/issues/994 @@ -118,7 +118,7 @@ func (d *resourceDescriptor) MarkManaged( // Should not happen. If it does, there is a bug in the code panic("nil RuntimeMetaObject in AWSResource") } - k8sctrlutil.AddFinalizer(obj, finalizerString) + k8sctrlutil.AddFinalizer(obj, FinalizerString) } // MarkUnmanaged removes the supplied resource from management by ACK. What @@ -133,7 +133,7 @@ func (d *resourceDescriptor) MarkUnmanaged( // Should not happen. If it does, there is a bug in the code panic("nil RuntimeMetaObject in AWSResource") } - k8sctrlutil.RemoveFinalizer(obj, finalizerString) + k8sctrlutil.RemoveFinalizer(obj, FinalizerString) } // MarkAdopted places descriptors on the custom resource that indicate the diff --git a/pkg/resource/domain/hooks.go b/pkg/resource/domain/hooks.go index ae3e451..bb4805a 100644 --- a/pkg/resource/domain/hooks.go +++ b/pkg/resource/domain/hooks.go @@ -16,6 +16,7 @@ package domain import ( "context" "errors" + "strings" "github.com/aws-controllers-k8s/opensearchservice-controller/apis/v1alpha1" ackv1alpha1 "github.com/aws-controllers-k8s/runtime/apis/core/v1alpha1" @@ -34,6 +35,7 @@ var ( errors.New("domain is currently processing changes, cannot be modified or deleted."), ackrequeue.DefaultRequeueAfterDuration, ) + noAutoTuneInstances = []string{"t2", "t3"} ) // domainProcessing returns true if the supplied domain is in a state of @@ -45,6 +47,19 @@ func domainProcessing(r *resource) bool { return *r.ko.Status.Processing } +// isAutoTuneSupported returns true if instance type supports AutoTune +// https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-instance-types.html +func isAutoTuneSupported(r *resource) bool { + if r.ko.Spec.ClusterConfig != nil && r.ko.Spec.ClusterConfig.InstanceType != nil { + for _, v := range noAutoTuneInstances { + if strings.HasPrefix(*r.ko.Spec.ClusterConfig.InstanceType, v) { + return false + } + } + } + return true +} + func (rm *resourceManager) customUpdateDomain(ctx context.Context, desired, latest *resource, delta *ackcompare.Delta) (updated *resource, err error) { rlog := ackrtlog.FromContext(ctx) diff --git a/pkg/resource/domain/sdk.go b/pkg/resource/domain/sdk.go index b533358..5ab4d2c 100644 --- a/pkg/resource/domain/sdk.go +++ b/pkg/resource/domain/sdk.go @@ -553,6 +553,16 @@ func (rm *resourceManager) sdkFind( } rm.setStatusDefaults(ko) + if resp.DomainStatus.AutoTuneOptions != nil && resp.DomainStatus.AutoTuneOptions.State != nil { + if *resp.DomainStatus.AutoTuneOptions.State == "ERROR" && !isAutoTuneSupported(&resource{ko}) { + // t2,t3 instances does not support AutoTuneOptions.DesiredState: DISABLED + // set value manually to remove delta + ko.Spec.AutoTuneOptions.DesiredState = aws.String("DISABLED") + } else { + ko.Spec.AutoTuneOptions.DesiredState = resp.DomainStatus.AutoTuneOptions.State + } + } + if domainProcessing(&resource{ko}) { // Setting resource synced condition to false will trigger a requeue of // the resource. No need to return a requeue error here. @@ -1079,6 +1089,16 @@ func (rm *resourceManager) sdkCreate( } rm.setStatusDefaults(ko) + if resp.DomainStatus.AutoTuneOptions != nil && resp.DomainStatus.AutoTuneOptions.State != nil { + if *resp.DomainStatus.AutoTuneOptions.State == "ERROR" && !isAutoTuneSupported(&resource{ko}) { + // t2,t3 instances does not support AutoTuneOptions.DesiredState: DISABLED + // set value manually to remove delta + ko.Spec.AutoTuneOptions.DesiredState = aws.String("DISABLED") + } else { + ko.Spec.AutoTuneOptions.DesiredState = resp.DomainStatus.AutoTuneOptions.State + } + } + if domainProcessing(&resource{ko}) { // Setting resource synced condition to false will trigger a requeue of // the resource. No need to return a requeue error here. diff --git a/templates/hooks/domain/sdk_create_post_set_output.go.tpl b/templates/hooks/domain/sdk_create_post_set_output.go.tpl index 95f6342..f562810 100644 --- a/templates/hooks/domain/sdk_create_post_set_output.go.tpl +++ b/templates/hooks/domain/sdk_create_post_set_output.go.tpl @@ -1,3 +1,13 @@ + if resp.DomainStatus.AutoTuneOptions != nil && resp.DomainStatus.AutoTuneOptions.State != nil { + if *resp.DomainStatus.AutoTuneOptions.State == "ERROR" && !isAutoTuneSupported(&resource{ko}){ + // t2,t3 instances does not support AutoTuneOptions.DesiredState: DISABLED + // set value manually to remove delta + ko.Spec.AutoTuneOptions.DesiredState = aws.String("DISABLED") + } else { + ko.Spec.AutoTuneOptions.DesiredState = resp.DomainStatus.AutoTuneOptions.State + } + } + if domainProcessing(&resource{ko}) { // Setting resource synced condition to false will trigger a requeue of // the resource. No need to return a requeue error here. diff --git a/templates/hooks/domain/sdk_read_one_post_set_output.go.tpl b/templates/hooks/domain/sdk_read_one_post_set_output.go.tpl index 9739e50..a99808f 100644 --- a/templates/hooks/domain/sdk_read_one_post_set_output.go.tpl +++ b/templates/hooks/domain/sdk_read_one_post_set_output.go.tpl @@ -1,3 +1,13 @@ + if resp.DomainStatus.AutoTuneOptions != nil && resp.DomainStatus.AutoTuneOptions.State != nil { + if *resp.DomainStatus.AutoTuneOptions.State == "ERROR" && !isAutoTuneSupported(&resource{ko}){ + // t2,t3 instances does not support AutoTuneOptions.DesiredState: DISABLED + // set value manually to remove delta + ko.Spec.AutoTuneOptions.DesiredState = aws.String("DISABLED") + } else { + ko.Spec.AutoTuneOptions.DesiredState = resp.DomainStatus.AutoTuneOptions.State + } + } + if domainProcessing(&resource{ko}) { // Setting resource synced condition to false will trigger a requeue of // the resource. No need to return a requeue error here.