Skip to content

Commit bbb1bc7

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

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,37 @@ def test_restore_cluster_to_latest_point_in_time(
448448
pass
449449

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

0 commit comments

Comments
 (0)