Skip to content

Commit

Permalink
Support azure flexible server versions 14 to 16
Browse files Browse the repository at this point in the history
  • Loading branch information
swoehrl-mw committed Mar 19, 2024
1 parent c0a9398 commit 28f6aa9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
18 changes: 14 additions & 4 deletions hybridcloud/backends/azure_postgresqlflexible.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def _backend_config(key, default=None, fail_if_missing=False):
EXTENSIONS_PARAMETER = "azure.extensions"
PRELOAD_LIST = ["timescaledb", "pg_cron", "pg_partman_bgw", "pg_partman", "pg_prewarm", "pg_stat_statements", "pgaudit", "pglogical", "wal2json"]

IGNORE_RESET_PARAMETERS = [PRELOAD_PARAMETER, EXTENSIONS_PARAMETER]
IGNORE_RESET_PARAMETERS = [PRELOAD_PARAMETER, EXTENSIONS_PARAMETER, "log_autovacuum_min_duration", "vacuum_cost_page_miss"]


def _calc_name(namespace, name):
Expand Down Expand Up @@ -230,14 +230,14 @@ def compare():

# Iterate through the server properties that are currently set on the server
for parameter in self._db_client.configurations.list_by_server(self._resource_group, server_name):

if parameter.is_read_only:
continue

# Extensions which are set above are part of the server properties and shouldn't be reset
if parameter.name in IGNORE_RESET_PARAMETERS:
continue

changed = False
value = ""

Expand Down Expand Up @@ -342,6 +342,7 @@ def update_user_password(self, namespace, server_name, username, password, admin
def _pgclient(self, admin_credentials, dbname=None) -> PostgresSQLClient:
return PostgresSQLClient(admin_credentials, dbname)


def _determine_sku(size_spec):
warnings = []
size_class = size_spec.get("class")
Expand Down Expand Up @@ -372,6 +373,15 @@ def _map_version(version: str):
return ServerVersion.ELEVEN
elif version.startswith("12"):
return ServerVersion.TWELVE
elif version.startswith("13"):
return ServerVersion.THIRTEEN
# versions 14-16 are not directly exposed in the API but as strings are still accepted
elif version.startswith("14"):
return "14"
elif version.startswith("15"):
return "15"
elif version.startswith("16"):
return "16"
else:
return ServerVersion.THIRTEEN

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
kubernetes==29.0.0
kopf==1.37.1
azure-mgmt-rdbms==10.2.0b15
# Do not use newest version as it removes some fields from the flexible server Configuration class (e.g. is_read_only)
azure-mgmt-rdbms==10.2.0b14
azure-identity==1.15.0
azure-mgmt-resource==23.0.1
psycopg2-binary==2.9.9
Expand Down

0 comments on commit 28f6aa9

Please sign in to comment.