Skip to content

Commit d89d208

Browse files
committed
Support DBCluster spec.PerformanceInsight updates
1 parent ee3d577 commit d89d208

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

pkg/resource/db_cluster/custom_update.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,16 @@ func (rm *resourceManager) newCustomUpdateRequestPayload(
662662
}
663663
res.SetCloudwatchLogsExportConfiguration(f24)
664664
}
665+
if delta.DifferentAt("Spec.PerformanceInsightsEnabled") && desired.ko.Spec.EnablePerformanceInsights != nil {
666+
res.SetEnablePerformanceInsights(*desired.ko.Spec.EnablePerformanceInsights)
667+
}
668+
if delta.DifferentAt("Spec.PerformanceInsightsKMSKeyID") && desired.ko.Spec.PerformanceInsightsKMSKeyID != nil {
669+
res.SetPerformanceInsightsKMSKeyId(*desired.ko.Spec.PerformanceInsightsKMSKeyID)
670+
}
671+
if delta.DifferentAt("Spec.PerformanceInsightsRetentionPeriod") && desired.ko.Spec.PerformanceInsightsRetentionPeriod != nil {
672+
res.SetPerformanceInsightsRetentionPeriod(*desired.ko.Spec.PerformanceInsightsRetentionPeriod)
673+
}
674+
665675
return res, nil
666676
}
667677

test/e2e/tests/test_db_cluster.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"""
1616

1717
import time
18+
import logging
1819

1920
import pytest
2021
from acktest.k8s import resource as k8s
@@ -448,3 +449,39 @@ def test_restore_cluster_to_latest_point_in_time(
448449
pass
449450

450451
db_cluster.wait_until_deleted(db_cluster_id)
452+
453+
454+
def test_enable_performance_insight(
455+
self, aurora_postgres_cluster_log_exports,
456+
):
457+
ref, _, db_cluster_id = aurora_postgres_cluster_log_exports
458+
db_cluster.wait_until(
459+
db_cluster_id,
460+
db_cluster.status_matches('available'),
461+
)
462+
463+
current = db_cluster.get(db_cluster_id)
464+
assert current is not None
465+
466+
performanceInsightsEnabled = current.get("PerformanceInsightsEnabled", None)
467+
assert performanceInsightsEnabled is None
468+
469+
k8s.patch_custom_resource(
470+
ref,
471+
{"spec": {"performanceInsightsEnabled": True}},
472+
)
473+
474+
db_cluster.wait_until(
475+
db_cluster_id,
476+
db_cluster.status_matches("available"),
477+
)
478+
479+
time.sleep(MODIFY_WAIT_AFTER_SECONDS)
480+
481+
latest = db_cluster.get(db_cluster_id)
482+
assert latest is not None
483+
484+
logging.info("+++++")
485+
logging.info(latest)
486+
performanceInsightsEnabled = current.get("PerformanceInsightsEnabled", None)
487+
assert performanceInsightsEnabled == True

0 commit comments

Comments
 (0)