Skip to content

Commit

Permalink
[MISC] Enable arm64 (#250)
Browse files Browse the repository at this point in the history
* Enable arm64

* Bump libs
  • Loading branch information
dragomirp authored Mar 20, 2024
1 parent fccfd11 commit 7c8b810
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
12 changes: 6 additions & 6 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

type: charm
bases:
- build-on:
- name: "ubuntu"
channel: "22.04"
run-on:
- name: "ubuntu"
channel: "22.04"
- name: ubuntu
channel: "22.04"
architectures: [amd64]
- name: ubuntu
channel: "22.04"
architectures: [arm64]

parts:
charm:
Expand Down
33 changes: 15 additions & 18 deletions lib/charms/postgresql_k8s/v0/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
Any charm using this library should import the `psycopg2` or `psycopg2-binary` dependency.
"""

import logging
from collections import OrderedDict
from typing import Dict, List, Optional, Set, Tuple
Expand All @@ -35,7 +36,7 @@

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 24
LIBPATCH = 25

INVALID_EXTRA_USER_ROLE_BLOCKING_MESSAGE = "invalid role(s) for extra user roles"

Expand Down Expand Up @@ -358,9 +359,7 @@ def _generate_database_privileges_statements(
statements.append(
"""UPDATE pg_catalog.pg_largeobject_metadata
SET lomowner = (SELECT oid FROM pg_roles WHERE rolname = '{}')
WHERE lomowner = (SELECT oid FROM pg_roles WHERE rolname = '{}');""".format(
user, self.user
)
WHERE lomowner = (SELECT oid FROM pg_roles WHERE rolname = '{}');""".format(user, self.user)
)
else:
for schema in schemas:
Expand Down Expand Up @@ -562,18 +561,16 @@ def build_postgresql_parameters(
parameters = {}
for config, value in config_options.items():
# Filter config option not related to PostgreSQL parameters.
if not config.startswith(
(
"durability",
"instance",
"logging",
"memory",
"optimizer",
"request",
"response",
"vacuum",
)
):
if not config.startswith((
"durability",
"instance",
"logging",
"memory",
"optimizer",
"request",
"response",
"vacuum",
)):
continue
parameter = "_".join(config.split("_")[1:])
if parameter in ["date_style", "time_zone"]:
Expand All @@ -594,8 +591,8 @@ def build_postgresql_parameters(
# and the remaining as cache memory.
shared_buffers = int(available_memory * 0.25)
effective_cache_size = int(available_memory - shared_buffers)
parameters.setdefault("shared_buffers", f"{int(shared_buffers/10**6)}MB")
parameters.update({"effective_cache_size": f"{int(effective_cache_size/10**6)}MB"})
parameters.setdefault("shared_buffers", f"{int(shared_buffers / 10**6)}MB")
parameters.update({"effective_cache_size": f"{int(effective_cache_size / 10**6)}MB"})
else:
# Return default
parameters.setdefault("shared_buffers", "128MB")
Expand Down
3 changes: 1 addition & 2 deletions metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ resources:
pgbouncer-image:
type: oci-image
description: OCI image for pgbouncer
# Rock version, using pgbouncer v1.18.
upstream-source: ghcr.io/canonical/charmed-postgresql@sha256:0cfc8cc4c096abdd713480d7cfa300e4edb15b59fc7db429a073a2c8179f5248
upstream-source: ghcr.io/canonical/charmed-postgresql@sha256:a9b6f25cc6a12b0cb81cb19be76804f4a9452e4388ab2a11efd2d57a316977c5

provides:
database:
Expand Down

0 comments on commit 7c8b810

Please sign in to comment.