Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support DBCluster spec.PerformanceInsight updates #198

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions pkg/resource/db_cluster/custom_update.go
Original file line number Diff line number Diff line change
@@ -662,6 +662,16 @@ func (rm *resourceManager) newCustomUpdateRequestPayload(
}
res.SetCloudwatchLogsExportConfiguration(f24)
}
if delta.DifferentAt("Spec.PerformanceInsightsEnabled") && desired.ko.Spec.EnablePerformanceInsights != nil {
res.SetEnablePerformanceInsights(*desired.ko.Spec.EnablePerformanceInsights)
}
if delta.DifferentAt("Spec.PerformanceInsightsKMSKeyID") && desired.ko.Spec.PerformanceInsightsKMSKeyID != nil {
res.SetPerformanceInsightsKMSKeyId(*desired.ko.Spec.PerformanceInsightsKMSKeyID)
}
if delta.DifferentAt("Spec.PerformanceInsightsRetentionPeriod") && desired.ko.Spec.PerformanceInsightsRetentionPeriod != nil {
res.SetPerformanceInsightsRetentionPeriod(*desired.ko.Spec.PerformanceInsightsRetentionPeriod)
}

return res, nil
}

37 changes: 37 additions & 0 deletions test/e2e/tests/test_db_cluster.py
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@
"""

import time
import logging

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

db_cluster.wait_until_deleted(db_cluster_id)


def test_enable_performance_insight(
self, aurora_postgres_cluster_log_exports,
):
ref, _, db_cluster_id = aurora_postgres_cluster_log_exports
db_cluster.wait_until(
db_cluster_id,
db_cluster.status_matches('available'),
)

current = db_cluster.get(db_cluster_id)
assert current is not None

performanceInsightsEnabled = current.get("PerformanceInsightsEnabled", None)
assert performanceInsightsEnabled is None

k8s.patch_custom_resource(
ref,
{"spec": {"performanceInsightsEnabled": True}},
)

db_cluster.wait_until(
db_cluster_id,
db_cluster.status_matches("available"),
)

time.sleep(MODIFY_WAIT_AFTER_SECONDS)

latest = db_cluster.get(db_cluster_id)
assert latest is not None

logging.info("+++++")
logging.info(latest)
performanceInsightsEnabled = current.get("PerformanceInsightsEnabled", None)
assert performanceInsightsEnabled == True