From 8c476eef5704705b81193d69ba9d8aea6da46626 Mon Sep 17 00:00:00 2001 From: Maarten de Waard <maarten@greenhost.nl> Date: Wed, 23 Feb 2022 14:10:28 +0100 Subject: [PATCH] fix mariadb persistence --- .../single-sign-on-database-values-configmap.yaml | 7 ++++--- install/generate_secrets.py | 14 ++++++++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/flux2/core/base/single-sign-on/single-sign-on-database-values-configmap.yaml b/flux2/core/base/single-sign-on/single-sign-on-database-values-configmap.yaml index 876e898ed..2f60358e4 100644 --- a/flux2/core/base/single-sign-on/single-sign-on-database-values-configmap.yaml +++ b/flux2/core/base/single-sign-on/single-sign-on-database-values-configmap.yaml @@ -7,9 +7,10 @@ data: values.yaml: | auth: rootPassword: '${database_root_password}' - persistence: - enabled: true - existingClaim: single-sign-on-database + primary: + persistence: + enabled: true + existingClaim: single-sign-on-database initdbScripts: setup.sql: | CREATE USER hydra IDENTIFIED BY '${hydra_database_password}'; diff --git a/install/generate_secrets.py b/install/generate_secrets.py index 3640fd75d..04aed3ff5 100644 --- a/install/generate_secrets.py +++ b/install/generate_secrets.py @@ -24,6 +24,7 @@ import yaml from kubernetes import client, config from kubernetes.client.exceptions import ApiException from kubernetes.utils import create_from_yaml +from kubernetes.utils.create_from_yaml import FailToCreateError # This script gets called with an app name as argument. Most of them need an # oauth client in Hydra, but some don't. This list contains the ones that @@ -161,10 +162,15 @@ def store_kubernetes_secret(secret_dict, namespace, update=False): api_response = patch_kubernetes_secret(secret_dict, namespace) else: verb = "created" - api_response = create_from_yaml( - api_client, - yaml_objects=[secret_dict], - namespace=namespace) + try: + api_response = create_from_yaml( + api_client, + yaml_objects=[secret_dict], + namespace=namespace) + except FailToCreateError as ex: + print(f"Secret not {verb} because of exception {ex}") + return + print(f"Secret {verb} with api response: {api_response}") def patch_kubernetes_secret(secret_dict, namespace): -- GitLab