From 5dde6160deb65759df693d622905331aa0029d72 Mon Sep 17 00:00:00 2001 From: Christoph Thalhammer <25662281+chrthal@users.noreply.github.com> Date: Tue, 2 Jul 2024 16:01:15 +0200 Subject: [PATCH 1/2] Updated old configuration checks --- charts/bitwarden-crd-operator/Chart.yaml | 4 ++-- src/kv.py | 5 ++++- src/template.py | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/charts/bitwarden-crd-operator/Chart.yaml b/charts/bitwarden-crd-operator/Chart.yaml index 8f0bd75..19b6291 100644 --- a/charts/bitwarden-crd-operator/Chart.yaml +++ b/charts/bitwarden-crd-operator/Chart.yaml @@ -6,7 +6,7 @@ type: application version: "v0.13.0" -appVersion: "0.12.0" +appVersion: "0.12.1" keywords: - operator @@ -117,4 +117,4 @@ annotations: description: "Allow custom type in templated secrets" artifacthub.io/images: | - name: bitwarden-crd-operator - image: ghcr.io/lerentis/bitwarden-crd-operator:0.12.0 + image: ghcr.io/lerentis/bitwarden-crd-operator:0.12.1 diff --git a/src/kv.py b/src/kv.py index 60deee9..0fc3099 100644 --- a/src/kv.py +++ b/src/kv.py @@ -112,7 +112,7 @@ def update_managed_secret( body.metadata.annotations['kopf.zalando.org/last-handled-configuration']) old_secret_name = old_config['spec'].get('name') old_secret_namespace = old_config['spec'].get('namespace') - old_secret_type = old_config['spec'].get('type') + old_secret_type = old_config['spec'].get('secretType') secret_name = spec.get('name') secret_namespace = spec.get('namespace') labels = spec.get('labels') @@ -122,6 +122,9 @@ def update_managed_secret( if not custom_secret_type: custom_secret_type = 'Opaque' + if not old_secret_type: + old_secret_type = 'Opaque' + if old_config is not None and ( old_secret_name != secret_name or old_secret_namespace != secret_namespace or old_secret_type != custom_secret_type): # If the name of the secret or the namespace of the secret is different diff --git a/src/template.py b/src/template.py index 5ccf7c5..f6ba633 100644 --- a/src/template.py +++ b/src/template.py @@ -103,10 +103,13 @@ def update_managed_secret( body.metadata.annotations['kopf.zalando.org/last-handled-configuration']) old_secret_name = old_config['spec'].get('name') old_secret_namespace = old_config['spec'].get('namespace') - old_secret_type = old_config['spec'].get('type') + old_secret_type = old_config['spec'].get('secretType') secret_name = spec.get('name') secret_namespace = spec.get('namespace') + if not old_secret_type: + old_secret_type = 'Opaque' + if old_config is not None and ( old_secret_name != secret_name or old_secret_namespace != secret_namespace or old_secret_type != custom_secret_type): # If the name of the secret or the namespace of the secret is different From 8f17ee7f17197bc8338c0226f76868bcde76ccc1 Mon Sep 17 00:00:00 2001 From: Christoph Thalhammer <25662281+chrthal@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:08:26 +0200 Subject: [PATCH 2/2] Updated versions --- charts/bitwarden-crd-operator/Chart.yaml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/charts/bitwarden-crd-operator/Chart.yaml b/charts/bitwarden-crd-operator/Chart.yaml index 19b6291..c408854 100644 --- a/charts/bitwarden-crd-operator/Chart.yaml +++ b/charts/bitwarden-crd-operator/Chart.yaml @@ -4,7 +4,7 @@ description: Deploy the Bitwarden CRD Operator type: application -version: "v0.13.0" +version: "v0.13.1" appVersion: "0.12.1" @@ -109,12 +109,8 @@ annotations: artifacthub.io/operator: "true" artifacthub.io/containsSecurityUpdates: "false" artifacthub.io/changes: | - - kind: added - description: "Allow custom type for generated secrets" - - kind: added - description: "Allow attachments in generated secrets" - - kind: added - description: "Allow custom type in templated secrets" + - kind: fixed + description: "Recreation of secrets where secretType is not defined." artifacthub.io/images: | - name: bitwarden-crd-operator image: ghcr.io/lerentis/bitwarden-crd-operator:0.12.1