A charmed operator for running PGbouncer on kubernetes.

Overview

operator-template

Description

TODO: Describe your charm in a few paragraphs of Markdown

Usage

TODO: Provide high-level usage, such as required config or relations

Relations

TODO: Provide any relations which are provided or required by your charm

OCI Images

TODO: Include a link to the default image your charm uses

Contributing

Please see the Juju SDK docs for guidelines on enhancements to this charm following best practice guidelines, and CONTRIBUTING.md for developer guidance.

Comments
  • Removed unnecessary user management

    Removed unnecessary user management

    Proposal

    The user management previously implemented in this charm is unnecessary, and has been removed. This PR is separate from the rest of the k8s charm update work to make it easier to review.

    Context

    This code was written when I had a worse understanding of the intended purpose of this charm. Postgres/pgbouncer users shouldn't be managed directly by the pgbouncer charm user; instead, they should be derived from the postgres charm relation. Therefore, this code is unnecessary.

    The failing integration tests are due to the docker image not being available on github; a future PR will fix this.

    Release Notes

    • Removed the following user management actions, as well as their associated tests:
      • change_password
      • add_user
      • remove_user
      • get_users

    Testing

    • Removed irrelevant unit & integration tests. Remaining unit & integration tests still pass.
    • Manually tested build & deploy stage
    opened by WRFitch 2
  • Added Basic Charm

    Added Basic Charm

    • Added basic pgbouncer charm based on pgbouncer container.
      • Since this container hasn't been pushed anywhere, the integration tests are failing. These should run fine once this is rectified, but in the meantime they pass locally. To run them locally, there should be instructions in contributing.md.
    • Added unit tests, coverage is now at 97%
    • added basic config file management.
      • These files are necessary for pgbouncer to run, but especially in the case of pgbouncer.ini, they can get very complex. Generating these more complex files will be updated in future PRs.
      • More encryption options for userlist.txt will be added in a future PR.
    • added user management actions.
    • Added some small amount of docs.

    Apologies for the size of this PR; future ones should be smaller and more incremental, and shouldn't have a bunch of user management stuff grafted on.

    opened by WRFitch 2
  • Configure Renovate

    Configure Renovate

    Mend Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • .github/workflows/ci.yaml (github-actions)
    • .github/workflows/release.yaml (github-actions)
    • requirements.txt (pip_requirements)

    Configuration Summary

    Based on the default config's presets, Renovate will:

    • Start dependency updates only once this onboarding PR is merged
    • Enable Renovate Dependency Dashboard creation.
    • If Renovate detects semantic commits, it will use semantic commit type fix for dependencies and chore for all others.
    • Ignore node_modules, bower_components, vendor and various test/tests directories.
    • Autodetect whether to pin dependencies or maintain ranges.
    • Rate limit PR creation to a maximum of two per hour.
    • Limit to maximum 10 open PRs at any time.
    • Group known monorepo packages together.
    • Use curated list of recommended non-monorepo package groupings.
    • A collection of workarounds for known problems with packages.

    🔡 Would you like to change the way Renovate is upgrading your dependencies? Simply edit the renovate.json in this branch with your custom config and the list of Pull Requests in the "What to Expect" section below will be updated the next time Renovate runs.


    What to Expect

    With your current configuration, Renovate will create 4 Pull Requests:

    Pin dependency ops to ==1.5.2
    • Schedule: ["at any time"]
    • Branch name: renovate/pin-dependencies
    • Merge into: main
    • Pin ops to ==1.5.2
    Update dependency tenacity to v8.1.0
    • Schedule: ["at any time"]
    • Branch name: renovate/tenacity-8.x
    • Merge into: main
    • Upgrade tenacity to ==8.1.0
    Update actions/checkout action to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-checkout-3.x
    • Merge into: main
    • Upgrade actions/checkout to v3
    Update canonical/charming-actions action to v2
    • Schedule: ["at any time"]
    • Branch name: renovate/canonical-charming-actions-2.x
    • Merge into: main
    • Upgrade canonical/charming-actions to 2.0.0

    🚸 Branch creation will be limited to maximum 2 per hour, so it doesn't swamp any CI resources or spam the project. See docs for prhourlylimit for details.


    ❓ Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 1
  • transferring lib ownership to k8s charm

    transferring lib ownership to k8s charm

    Proposal

    The pgbouncer charm lib previously lived on the VM charm. Since I'm planning to use the k8s charm for development moving forward, porting implementation over to the VM charm once it's fully implemented, tested, and reviewed, it makes sense to keep the charm library on the k8s charm as well.

    Context

    • I'm planning to use the k8s charm for development because it builds and deploys faster, making testing and development faster.
    • All this code has already been reviewed on the VM charm, I'm just changing the names of things and copying unit tests over.

    Release Notes

    • Rename pgb lib and copy unit tests over from VM charm.

    Testing

    • Unit and integration tests have run
    opened by WRFitch 1
  • Persist userlist and PGB config on controller restart

    Persist userlist and PGB config on controller restart

    Proposal

    When we restart the k8s controller on which a PGB operator runs, we lose our containers and therefore our config. This PR checks the peer databag for config files if they aren't available in the filesystem.

    Context

    • We can't keep logs because they aren't stored anywhere, and if they were, they should probably live in COS.

    Release Notes

    • Check peer databag for config files if they aren't available in filesystem.

    Testing

    • Added an integration test that restarts the juju controller pod.
    opened by WRFitch 0
  • DPE-781 Run integration tests for passed lint/unit tests only

    DPE-781 Run integration tests for passed lint/unit tests only

    Avoid a long-running integration test in case of failing gatekeeping tests. It will slightly increase the complete tests scope runtime but will save (a lot?) of electricity/money for Canonical as often new pull requests have some initial typos/issues to be polished.

    Proposal

    DPE-781 Run integration tests for passed lint/unit tests only

    Context

    Costs optimizations for long tests execution (c) John.

    Release Notes

    Run integration tests for passed lint/unit tests only.

    Testing

    Tested by GitHub action only.

    opened by taurus-forever 0
  • Add TLS encryption between PgBouncer and PostgreSQL

    Add TLS encryption between PgBouncer and PostgreSQL

    Proposal

    Jira issue: DPE-560 PgBouncer must use encrypted connections when PostgreSQL has TLS enabled.

    Context

    • This is the same implementation that was made on https://github.com/canonical/pgbouncer-operator/pull/22.

    • The difference is that the logs are retrieved using /charm/bin/pebble logs -n=all instead of journalctl -u patroni.service on tests/integration/relations/test_backend_database.py.

    • Also, some typing errors were fixed, similarly to https://github.com/canonical/pgbouncer-operator/pull/25.

    Release Notes

    • Enable TLS encrypted connection between PgBouncer and PostgreSQL.

    Testing

    • tests/integration/relations/test_backend_database.py contains an additional integration test that checks that TLS is being used.
    opened by marceloneppel 0
  • Add client relation

    Add client relation

    Proposal

    Add new client relations

    Context

    • This PR is huge, but ~1100 lines of it is libs, lib updates, and the integration test charm. You can skip the following files:
      • everything under lib/
      • tests/integration/relations/pgbouncer_provider/application-charm/lib/charms/data_platform_libs/v0/database_requires.py
    • Read pgbouncer_provider.py before reviewing other charm code - the changes added in this file are the reason for the changes in the other files, so reading it first should provide context for the other changes.
    • The following PRs implement the same logic in the VM charm, broken into more manageable chunks:
      • https://github.com/canonical/pgbouncer-operator/pull/32
      • https://github.com/canonical/pgbouncer-operator/pull/33
      • https://github.com/canonical/pgbouncer-operator/pull/34

    Release Notes

    • Add new fully tested client relation
    • Update CI
    • Update docs
    • Fix leader-deletion bug
    • Better backend health checks
    • General stabilisation work, including updating connection info on pretty much every hook event.
    • Brought k8s charm more in line with VM charm design.

    Testing

    • Updated CI
    • Added relevant integration tests & unit tests
      • This includes testing new relation and legacy relation simultaneously
    opened by WRFitch 0
  • Fix endpoints to point to correct units when scaling

    Fix endpoints to point to correct units when scaling

    Proposal

    Fixes endpoints to point to the correct units when scaling.

    Context

    I forgot to update how master/standby endpoints are updated when adding scaling. This PR adds that in.

    Testing

    Updated unit tests, integration tests all pass fine.

    opened by WRFitch 0
  • Scaling

    Scaling

    Proposal

    Jira issue: DPE-472 This PR allows PgBouncer to scale to multiple units.

    Context

    • We're storing everything in the peer databag for now, including usernames and passwords for the db relations. These will be removed to Juju secrets once they exist.
    • The config is stored as an ini file in the databag, rather than a json file, because it's an existing string representation of the data and it's more readable (although there's a bug in jhack that doesn't display the headers)

    Release Notes

    • added pgb_peers relation and corresponding integration test run
    • updated integration test runners to use juju version 2.9.29 to work around scale-down bug.
    • added juju get_secret interface

    Testing

    • updated unit tests
    • updated the existing db integration test to work with scaled pgbouncer
      • db-admin test has not been updated because discourse behaves weirdly
    opened by WRFitch 0
  • Implemented on-start hook

    Implemented on-start hook

    Proposal

    The install hook isn't well suited for kubernetes charms, so replace it with start.

    Release Notes

    • replace on-install with on-start
    • moved integration test helper functions to integration directory.

    Testing

    • Integration and unit tests run locally and on CI
    opened by WRFitch 0
  • Pin OS on release workflow

    Pin OS on release workflow

    Issue

    As the ubuntu-latest GH runner image (it's still being updated on other places) was updated to jammy, the step that publishes the charm broke (due to using --destructive-mode).

    We can see the issue on https://github.com/canonical/pgbouncer-k8s-operator/actions/runs/3687788578/jobs/6255386375.

    Solution

    Pin focal runner image (ubuntu-20.04) on release workflow.

    Context

    The bases on charmcraft.yaml weren't updated to jammy as there are some issues related to some python wheels that should be solved when the work to move the charm to jammy is done.

    Testing

    Tested sudo charmcraft pack --destructive-mode --quiet manually on a focal VM.

    Release Notes

    Pin focal runner image on release workflow.

    opened by marceloneppel 0
Releases(rev9)
  • rev9(Dec 1, 2022)

    resources:

    Static resources:

    • pgbouncer-image resource-revision: 2 Released to 'latest/edge' at 15:38 UTC on 1 Dec 2022

    What's Changed

    • Persist userlist and PGB config on controller restart by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/24

    Full Changelog: https://github.com/canonical/pgbouncer-k8s-operator/compare/rev8...rev9

    Source code(tar.gz)
    Source code(zip)
  • rev8(Nov 22, 2022)

    resources:

    Static resources:

    • pgbouncer-image resource-revision: 2 Released to 'latest/edge' at 10:48 UTC on 22 Nov 2022

    What's Changed

    • DPE-781 Run integration tests for passed lint/unit tests only by @taurus-forever in https://github.com/canonical/pgbouncer-k8s-operator/pull/22
    • Add group to pebble layer. by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/25

    New Contributors

    • @taurus-forever made their first contribution in https://github.com/canonical/pgbouncer-k8s-operator/pull/22

    Full Changelog: https://github.com/canonical/pgbouncer-k8s-operator/compare/rev7...rev8

    Source code(tar.gz)
    Source code(zip)
  • rev7(Oct 6, 2022)

    resources:

    Static resources:

    • pgbouncer-image resource-revision: 2 Released to 'latest/edge' at 12:36 UTC on 6 Oct 2022

    What's Changed

    • Add TLS encryption between PgBouncer and PostgreSQL by @marceloneppel in https://github.com/canonical/pgbouncer-k8s-operator/pull/20

    New Contributors

    • @marceloneppel made their first contribution in https://github.com/canonical/pgbouncer-k8s-operator/pull/20

    Full Changelog: https://github.com/canonical/pgbouncer-k8s-operator/compare/rev6...rev7

    Source code(tar.gz)
    Source code(zip)
  • rev6(Sep 27, 2022)

    resources:

    Static resources:

    • pgbouncer-image resource-revision: 2 Released to 'latest/edge' at 16:44 UTC on 27 Sep 2022

    What's Changed

    • Fix endpoints to point to correct units when scaling by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/18

    Full Changelog: https://github.com/canonical/pgbouncer-k8s-operator/compare/rev5...rev6

    Source code(tar.gz)
    Source code(zip)
  • rev5(Sep 7, 2022)

    resources:

    Static resources:

    • pgbouncer-image resource-revision: 2 Released to 'latest/edge' at 14:55 UTC on 7 Sep 2022

    What's Changed

    • Scaling by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/16
    • fixed release CI to use correct juju version by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/17

    Full Changelog: https://github.com/canonical/pgbouncer-k8s-operator/compare/rev4...rev5

    Source code(tar.gz)
    Source code(zip)
  • rev4(Aug 22, 2022)

    resources:

    Static resources:

    • pgbouncer-image resource-revision: 2 Released to 'latest/edge' at 14:15 UTC on 22 Aug 2022

    What's Changed

    • Implemented on-start hook by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/15

    Full Changelog: https://github.com/canonical/pgbouncer-k8s-operator/compare/rev3...rev4

    Source code(tar.gz)
    Source code(zip)
  • rev3(Aug 18, 2022)

    resources:

    Static resources:

    • pgbouncer-image resource-revision: 2 Released to 'latest/edge' at 10:10 UTC on 18 Aug 2022

    What's Changed

    • Remove userlist by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/12

    Full Changelog: https://github.com/canonical/pgbouncer-k8s-operator/compare/rev2...rev3

    Source code(tar.gz)
    Source code(zip)
  • rev2(Aug 15, 2022)

    resources:

    Static resources:

    • pgbouncer-image resource-revision: 2 Released to 'latest/edge' at 17:55 UTC on 15 Aug 2022

    What's Changed

    • Added Basic Charm by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/1
    • DPE-108 Add PR template by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/2
    • Removed unnecessary user management by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/4
    • DPE-213 add build step to CI by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/3
    • DPE-102 Add Charm Library by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/5
    • Add backend-db-admin legacy relation by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/6
    • Update backend db admin relation by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/7
    • Added integration tests to backend relation by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/9
    • Add db relations by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/10
    • transferring lib ownership to k8s charm by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/11
    • add release to charmhub by @paulomach in https://github.com/canonical/pgbouncer-k8s-operator/pull/8
    • image override to pin uploaded revision by @paulomach in https://github.com/canonical/pgbouncer-k8s-operator/pull/13
    • Add lib to charmhub by @WRFitch in https://github.com/canonical/pgbouncer-k8s-operator/pull/14

    New Contributors

    • @WRFitch made their first contribution in https://github.com/canonical/pgbouncer-k8s-operator/pull/1
    • @paulomach made their first contribution in https://github.com/canonical/pgbouncer-k8s-operator/pull/8

    Full Changelog: https://github.com/canonical/pgbouncer-k8s-operator/commits/rev2

    Source code(tar.gz)
    Source code(zip)
Owner
Canonical
Canonical
Project 4 Cloud DevOps Nanodegree

Project Overview In this project, you will apply the skills you have acquired in this course to operationalize a Machine Learning Microservice API. Yo

1 Nov 21, 2021
A repository containing a short tutorial for Docker (with Python).

Docker Tutorial for IFT 6758 Lab In this repository, we examine the advtanges of virtualization, what Docker is and how we can deploy simple programs

Arka Mukherjee 0 Dec 14, 2021
Python job scheduling for humans.

schedule Python job scheduling for humans. Run Python functions (or any other callable) periodically using a friendly syntax. A simple to use API for

Dan Bader 10.4k Jan 02, 2023
Big data on k8s

# microsoft azure # https://docs.microsoft.com/en-us/cli/azure/install-azure-cli az account set --subscription [] az aks get-credentials --resource-g

Luan Moreno 22 Dec 24, 2022
Emissary - open source Kubernetes-native API gateway for microservices built on the Envoy Proxy

Emissary-ingress Emissary-Ingress is an open-source Kubernetes-native API Gateway + Layer 7 load balancer + Kubernetes Ingress built on Envoy Proxy. E

Emissary Ingress 4k Dec 31, 2022
Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:

Latest Salt Documentation Open an issue (bug report, feature request, etc.) Salt is the world’s fastest, most intelligent and scalable automation engi

SaltStack 12.9k Jan 04, 2023
ServerStatus 云探针、多服务器探针、云监控、多服务器云监控

ServerStatus 云探针、多服务器探针、云监控、多服务器云监控 基于ServerStatus-Hotaru膜改版的套娃膜改版(实际上本README也是抄它的)。 主要将client改为通过http提交数据,以及将服务端换成了php以便减小部署成本(PHP is the best!) 默认图片

shirakun 16 Apr 14, 2022
Get Response Of Container Deployment Kube with python

get-response-of-container-deployment-kube 概要 get-response-of-container-deployment-kube は、例えばエッジコンピューティング環境のコンテナデプロイメントシステムにおいて、デプロイ元の端末がデプロイ先のコンテナデプロイ

Latona, Inc. 3 Nov 05, 2021
A collection of beginner-friendly DevOps content

mansion Mansion is just a testing repo for learners to commit into open source project. These are the steps you need to learn: Please do not edit thes

Bryan Lim 62 Nov 30, 2022
Oncall is a calendar tool designed for scheduling and managing on-call shifts. It can be used as source of dynamic ownership info for paging systems like http://iris.claims.

Oncall See admin docs for information on how to run and manage Oncall. Development setup Prerequisites Debian/Ubuntu - sudo apt-get install libsasl2-d

LinkedIn 928 Dec 22, 2022
Python IMDB Docker - A docker tutorial to containerize a python script.

Python_IMDB_Docker A docker tutorial to containerize a python script. Build the docker in the current directory: docker build -t python-imdb . Run the

Sarthak Babbar 1 Dec 30, 2021
The low-level, core functionality of boto 3.

botocore A low-level interface to a growing number of Amazon Web Services. The botocore package is the foundation for the AWS CLI as well as boto3. On

the boto project 1.2k Jan 03, 2023
Build Netbox as a Docker container

netbox-docker The Github repository houses the components needed to build Netbox as a Docker container. Images are built using this code and are relea

Farshad Nick 1 Dec 18, 2021
gunicorn 'Green Unicorn' is a WSGI HTTP Server for UNIX, fast clients and sleepy applications.

Gunicorn Gunicorn 'Green Unicorn' is a Python WSGI HTTP Server for UNIX. It's a pre-fork worker model ported from Ruby's Unicorn project. The Gunicorn

Benoit Chesneau 8.7k Jan 08, 2023
A lobby boy will create a VPS server when you need one, and destroy it after using it.

Lobbyboy What is a lobby boy? A lobby boy is completely invisible, yet always in sight. A lobby boy remembers what people hate. A lobby boy anticipate

226 Dec 29, 2022
Push Container Image To Docker Registry In Python

push-container-image-to-docker-registry 概要 push-container-image-to-docker-registry は、エッジコンピューティング環境において、特定のエッジ端末上の Private Docker Registry に特定のコンテナイメー

Latona, Inc. 3 Nov 04, 2021
Tiny Git is a simplified version of Git with only the basic functionalities to gain better understanding of git internals.

Tiny Git is a simplified version of Git with only the basic functionalities to gain better understanding of git internals. Implemented Functi

Ahmed Ayman 2 Oct 15, 2021
Build and Push docker image in Python (luigi + docker-py)

Docker build images workflow in Python Since docker hub stopped building images for free accounts, I've been looking for another way to do it. I could

Fabien D. 2 Dec 15, 2022
Deploy a simple Multi-Node Clickhouse Cluster with docker-compose in minutes.

Simple Multi Node Clickhouse Cluster I hate those single-node clickhouse clusters and manually installation, I mean, why should we: Running multiple c

Nova Kwok 11 Nov 18, 2022
Hw-ci - Hardware CD/CI and Development Container

Hardware CI & Dev Containter These containers were created for my personal hardware development projects and courses duing my undergraduate degree. Pl

Matthew Dwyer 6 Dec 25, 2022