Skip to content

Commit

Permalink
Small code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
swoehrl-mw committed Aug 1, 2023
1 parent 1200d2c commit e200c3c
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 19 deletions.
2 changes: 2 additions & 0 deletions helm/hybrid-cloud-postgresql-operator-crds/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ description: Installs the CRDs for the hybrid-cloud-postgresql-operator
type: application
version: 0.0.1
appVersion: "0.1.0"
sources:
- https://github.com/MaibornWolff/hybrid-cloud-postgresql-operator
2 changes: 2 additions & 0 deletions helm/hybrid-cloud-postgresql-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ description: Installs the hybrid-cloud-postgresql-operator
type: application
version: 0.0.1
appVersion: "0.1.0"
sources:
- https://github.com/MaibornWolff/hybrid-cloud-postgresql-operator
1 change: 0 additions & 1 deletion hybridcloud/backends/aws_aurora.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import time
import kopf
from .aws_base import AwsBackendBase, calculate_maintenance_window
from .pgclient import PostgresSQLClient
from ..config import get_one_of, config_get
from ..util.reconcile_helpers import field_from_spec

Expand Down
3 changes: 1 addition & 2 deletions hybridcloud/backends/aws_base.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import time
import kopf
from .pgclient import PostgresSQLClient
from ..util.aws import aws_client_rds
from ..util.reconcile_helpers import field_from_spec
Expand Down Expand Up @@ -52,6 +50,7 @@ def _pgclient(self, admin_credentials, dbname=None) -> PostgresSQLClient:

weekdays = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"]


def calculate_maintenance_window(spec):
# ddd:hh24:mi-ddd:hh24:mi
window = field_from_spec(spec, "maintenance.window")
Expand Down
1 change: 0 additions & 1 deletion hybridcloud/backends/aws_rds.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import time
import kopf
from .aws_base import AwsBackendBase, calculate_maintenance_window
from .pgclient import PostgresSQLClient
from ..config import get_one_of, config_get
from ..util.reconcile_helpers import field_from_spec

Expand Down
5 changes: 2 additions & 3 deletions hybridcloud/backends/azure_postgresql.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from logging import warning
from azure.core.exceptions import ResourceNotFoundError
from azure.mgmt.rdbms.postgresql.models import ServerForCreate, ServerPropertiesForDefaultCreate, ServerUpdateParameters, ServerVersion, Sku, StorageProfile, Database, Configuration, VirtualNetworkRule, FirewallRule
from azure.mgmt.network.models import PrivateEndpoint, Subnet, PrivateLinkServiceConnection
from azure.mgmt.rdbms.postgresql.models import ServerForCreate, ServerPropertiesForDefaultCreate, ServerUpdateParameters, ServerVersion, Sku, StorageProfile, Database, Configuration, VirtualNetworkRule, FirewallRule
from azure.mgmt.resource.locks.models import ManagementLockObject
from .pgclient import PostgresSQLClient
from ..util.azure import azure_client_locks, azure_client_postgres, azure_client_network, azure_client_privatedns
from ..config import get_one_of, config_get
from ..util.azure import azure_client_locks, azure_client_postgres, azure_client_network, azure_client_privatedns
from ..util.reconcile_helpers import field_from_spec


Expand Down
3 changes: 2 additions & 1 deletion hybridcloud/backends/azure_postgresqlflexible.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from azure.mgmt.resource.locks.models import ManagementLockObject
import kopf
from .pgclient import PostgresSQLClient
from ..util.azure import azure_client_locks, azure_client_postgres_flexible, azure_client_network, azure_client_privatedns
from ..config import get_one_of, config_get
from ..util.azure import azure_client_locks, azure_client_postgres_flexible, azure_client_network, azure_client_privatedns
from ..util.reconcile_helpers import field_from_spec


Expand All @@ -19,6 +19,7 @@ def _backend_config(key, default=None, fail_if_missing=False):

IGNORE_RESET_PARAMETERS = [PRELOAD_PARAMETER, EXTENSIONS_PARAMETER]


def _calc_name(namespace, name):
# Allow admins to override names so that existing storage accounts not following the schema can still be managed
name_overrides = _backend_config("name_overrides", default=[])
Expand Down
4 changes: 1 addition & 3 deletions hybridcloud/backends/helm_postgres.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import os
import logging
from .pgclient import PostgresSQLClient
from ..config import config_get
from ..util import helm
from ..util import k8s
from ..util import helm, k8s
from ..util.constants import HELM_BASE_PATH


Expand Down
3 changes: 1 addition & 2 deletions hybridcloud/backends/helm_yugabyte.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os
from .pgclient import PostgresSQLClient
from ..config import config_get
from ..util import helm
from ..util import k8s
from ..util import helm, k8s
from ..util.constants import HELM_BASE_PATH


Expand Down
5 changes: 2 additions & 3 deletions hybridcloud/handlers/postgresql_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
import kopf
from .routing import postgres_backend
from ..config import config_get
from ..util import env, k8s
from ..util.constants import BACKOFF
from ..util.password import generate_password
from ..util.reconcile_helpers import process_action_label, ignore_control_label_change, determine_resource_password, shorten
from ..util import k8s
from ..util import env
from ..util.constants import BACKOFF


def _tmp_secret(namespace, name):
Expand Down
5 changes: 2 additions & 3 deletions hybridcloud/handlers/postgresql_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
import kopf
from .routing import postgres_backend
from ..config import config_get
from ..util import env, k8s
from ..util.constants import BACKOFF
from ..util.password import generate_password
from ..util.reconcile_helpers import ignore_control_label_change, process_action_label, determine_resource_password, shorten
from ..util import k8s
from ..util import env
from ..util.constants import BACKOFF


def _tmp_secret(namespace, name):
Expand Down

0 comments on commit e200c3c

Please sign in to comment.