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
DAMPP (gui) is a Python based program to run simple webservers using MySQL, Php, Apache and PhpMyAdmin inside of Docker containers.

DAMPP (gui) is a Python based program to run simple webservers using MySQL, Php, Apache and PhpMyAdmin inside of Docker containers.

Sehan Weerasekara 1 Feb 19, 2022
a CLI that provides a generic automation layer for assessing the security of ML models

Counterfit About | Getting Started | Learn More | Acknowledgments | Contributing | Trademarks | Contact Us -------------------------------------------

Microsoft Azure 575 Jan 02, 2023
A Python Implementation for Git for learning

A pure Python implementation for Git based on Buliding Git

shidenggui 42 Jul 13, 2022
Docker Container wallstreetbets-sentiment-analysis

Docker Container wallstreetbets-sentiment-analysis A docker container using restful endpoints exposed on port 5000 "/analyze" to gather sentiment anal

145 Nov 22, 2022
Play Wordle from any Kubernetes cluster.

wordle-operator 🟩 ⬛ 🟩 🟨 ⬛ Play Wordle from any Kubernetes cluster. Using the power of CustomResourceDefinitions and Kubernetes Operators, now you c

Lucas Melin 1 Jan 15, 2022
A declarative Kubeflow Management Tool inspired by Terraform

🍭 KRSH is Alpha version, so many bugs can be reported. If you find a bug, please write an Issue and grow the project together! A declarative Kubeflow

Riiid! 128 Oct 18, 2022
Checkmk kube agent - Checkmk Kubernetes Cluster and Node Collectors

Checkmk Kubernetes Cluster and Node Collectors Checkmk cluster and node collecto

tribe29 GmbH 15 Dec 26, 2022
A tool to convert AWS EC2 instances back and forth between On-Demand and Spot billing models.

ec2-spot-converter This tool converts existing AWS EC2 instances back and forth between On-Demand and 'persistent' Spot billing models while preservin

jcjorel 152 Dec 29, 2022
Run your clouds in RAID.

UniKlaud Run your clouds in RAID Table of Contents About The Project Built With Getting Started Installation Usage Roadmap Contributing License Contac

3 Jan 16, 2022
Organizing ssh servers in one shell.

NeZha (哪吒) NeZha is a famous chinese deity who can have three heads and six arms if he wants. And my NeZha tool is hoping to bring developer such mult

Zilin Zhu 8 Dec 20, 2021
Chartreuse: Automated Alembic migrations within kubernetes

Chartreuse: Automated Alembic SQL schema migrations within kubernetes "How to automate management of Alembic database schema migration at scale using

Wiremind 8 Oct 25, 2022
Tools and Docker images to make a fast Ruby on Rails development environment

Tools and Docker images to make a fast Ruby on Rails development environment. With the production templates, moving from development to production will be seamless.

1 Nov 13, 2022
This repository contains useful docker-swarm-tools.

docker-swarm-tools This repository contains useful docker-swarm-tools. swarm-guardian This Docker image is intended to be used in a multihost docker e

NeuroForge GmbH & Co. KG 4 Jan 12, 2022
NixOps is a tool for deploying to NixOS machines in a network or cloud.

NixOps NixOps is a tool for deploying to NixOS machines in a network or the cloud. Key features include: Declarative: NixOps determines and carries ou

Nix/Nixpkgs/NixOS 1.2k Jan 02, 2023
DC/OS - The Datacenter Operating System

DC/OS - The Datacenter Operating System The easiest way to run microservices, big data, and containers in production. What is DC/OS? Like traditional

DC/OS 2.3k Jan 06, 2023
Containerize a python web application

containerize a python web application introduction this document is part of GDSC at the university of bahrain you don't need to follow along, fell fre

abdullah mosibah 1 Oct 19, 2021
Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.

Glances - An eye on your system Summary Glances is a cross-platform monitoring tool which aims to present a large amount of monitoring information thr

Nicolas Hennion 22k Jan 08, 2023
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
This repository contains code examples and documentation for learning how applications can be developed with Kubernetes

BigBitBus KAT Components Click on the diagram to enlarge, or follow this link for detailed documentation Introduction Welcome to the BigBitBus Kuberne

51 Oct 16, 2022
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