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

✨ Enable the builtin postgres configuration #1327

Merged
merged 3 commits into from
Jan 15, 2025

Conversation

yanmxa
Copy link
Member

@yanmxa yanmxa commented Jan 13, 2025

Summary

You need to restart the Postgres instance for the configuration to take effect!

Fixed: https://issues.redhat.com/browse/ACM-16887

Resolved: #1320, which provides the details for addressing the aforementioned Jira issue.

Tests

  • Unit/function tests have been added and incorporated into make unit-tests.
  • Integration tests have been added and incorporated into make integration-test.
  • E2E tests have been added and incorporated into make e2e-test-all.
  • List other manual tests you have done.
  • Check the configuration before
❯ kubectl exec -it multicluster-global-hub-postgresql-0 -n multicluster-global-hub -- psql -U postgres -d hoh;

Defaulted container "multicluster-global-hub-postgresql" out of: multicluster-global-hub-postgresql, prometheus-postgres-exporter
psql (16.4)
Type "help" for help.

hoh=# SHOW wal_level;
 wal_level
-----------
 replica
(1 row)

hoh=# SHOW max_wal_size;
 max_wal_size
--------------
 1GB
(1 row)

hoh=# exit
  • Change the configuration
❯ oc get cm multicluster-global-hub-custom-postgresql-config -oyaml
apiVersion: v1
data:
  postgresql.conf: |
    wal_level = logical
    max_wal_size = 2GB
kind: ConfigMap
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","data":{"postgresql.conf":"wal_level = logical\nmax_wal_size = 2GB\n"},"kind":"ConfigMap","metadata":{"annotations":{},"name":"multicluster-global-hub-custom-postgresql-config","namespace":"multicluster-global-hub"}}
  creationTimestamp: "2025-01-13T08:40:51Z"
  name: multicluster-global-hub-custom-postgresql-config
  namespace: multicluster-global-hub
  resourceVersion: "41591561"
  uid: 2b292e02-bab9-479f-a8b9-128e70a8a119
❯ oc get cm multicluster-global-hub-postgresql-config -oyaml
apiVersion: v1
data:
  postgresql.conf: |
    ssl = on
    ssl_cert_file = '/opt/app-root/src/certs/tls.crt' # server certificate
    ssl_key_file =  '/opt/app-root/src/certs/tls.key' # server private key
    ssl_min_protocol_version = TLSv1.3
    shared_preload_libraries = 'pg_stat_statements'
    pg_stat_statements.max = 10000
    pg_stat_statements.track = all
    wal_level = logical
    max_wal_size = 2GB
kind: ConfigMap
metadata:
  creationTimestamp: "2025-01-08T11:04:23Z"
  labels:
    global-hub.open-cluster-management.io/managed-by: global-hub-operator
  name: multicluster-global-hub-postgresql-config
  namespace: multicluster-global-hub
  ownerReferences:
  - apiVersion: operator.open-cluster-management.io/v1alpha4
    blockOwnerDeletion: true
    controller: true
    kind: MulticlusterGlobalHub
    name: multiclusterglobalhub
    uid: 1522175f-8e05-46cd-b8b5-17c65a72e20b
  resourceVersion: "41603005"
  uid: c496c5aa-37e5-4d82-8a6c-45a570ecbfdb
  • Restart the instance and verify the configuration has been applied successfully
❯ oc get pods
NAME                                                READY   STATUS    RESTARTS      AGE
kafka-entity-operator-c5d866b4b-s9p2r               2/2     Running   0             4d21h
kafka-kraft-0                                       1/1     Running   0             4d22h
multicluster-global-hub-grafana-79bd77df4f-t92mh    2/2     Running   0             4d22h
multicluster-global-hub-manager-65945b9d89-74fln    1/1     Running   0             3m15s
multicluster-global-hub-operator-6ccd7577fd-8ktrk   1/1     Running   0             3m24s
multicluster-global-hub-postgresql-0                2/2     Running   0             4d3h
strimzi-cluster-operator-v0.43.0-76f57fb5b7-ks9kk   1/1     Running   1 (12h ago)   4d22h
❯ oc delete pods multicluster-global-hub-postgresql-0
pod "multicluster-global-hub-postgresql-0" deleted
❯ oc get pods
NAME                                                READY   STATUS    RESTARTS      AGE
kafka-entity-operator-c5d866b4b-s9p2r               2/2     Running   0             4d21h
kafka-kraft-0                                       1/1     Running   0             4d22h
multicluster-global-hub-grafana-79bd77df4f-t92mh    2/2     Running   0             4d22h
multicluster-global-hub-manager-65945b9d89-74fln    1/1     Running   0             4m9s
multicluster-global-hub-operator-6ccd7577fd-8ktrk   1/1     Running   0             4m18s
multicluster-global-hub-postgresql-0                2/2     Running   0             13s
strimzi-cluster-operator-v0.43.0-76f57fb5b7-ks9kk   1/1     Running   1 (12h ago)   4d22h
❯ kubectl exec -it multicluster-global-hub-postgresql-0 -n multicluster-global-hub -- psql -U postgres -d hoh;

Defaulted container "multicluster-global-hub-postgresql" out of: multicluster-global-hub-postgresql, prometheus-postgres-exporter
psql (16.4)
Type "help" for help.

hoh=# SHOW wal_level;
 wal_level
-----------
 logical
(1 row)

hoh=# SHOW max_wal_size;
 max_wal_size
--------------
 2GB
(1 row)

hoh=# exit

Signed-off-by: myan <myan@redhat.com>
Signed-off-by: myan <myan@redhat.com>
Copy link
Contributor

@clyang82 clyang82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pkg/constants/constants.go Outdated Show resolved Hide resolved
Signed-off-by: myan <myan@redhat.com>
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
68.0% Coverage on New Code (required ≥ 70%)

See analysis details on SonarQube Cloud

Copy link

openshift-ci bot commented Jan 15, 2025

@yanmxa: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/sonarcloud 32b634e link true /test sonarcloud

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@yanmxa
Copy link
Member Author

yanmxa commented Jan 15, 2025

Need provide a document in https://github.com/stolostron/multicluster-global-hub/tree/main/doc

Add the document in this PR: #1329

Copy link
Contributor

@clyang82 clyang82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

openshift-ci bot commented Jan 15, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: clyang82, yanmxa

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@clyang82 clyang82 merged commit 166e7e6 into stolostron:main Jan 15, 2025
12 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make postgres server configurable
2 participants