Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/secret recreation #91

Merged
merged 2 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions charts/bitwarden-crd-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ description: Deploy the Bitwarden CRD Operator

type: application

version: "v0.13.0"
version: "v0.13.1"

appVersion: "0.12.0"
appVersion: "0.12.1"

keywords:
- operator
Expand Down Expand Up @@ -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.0
image: ghcr.io/lerentis/bitwarden-crd-operator:0.12.1
5 changes: 4 additions & 1 deletion src/kv.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion src/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down