From 5234ade3903c95f13db879fc95082b8503e7b1e4 Mon Sep 17 00:00:00 2001 From: Max! Date: Sun, 7 Jul 2024 14:46:35 +0200 Subject: [PATCH] Feature: support `notes` field and downgrade appVersion to 0.7.0 till bw cli is fixed upstream (#113) * Update _helpers.tpl * add fields secretstore and bump chart * helm-docs: automated action * Update charts/bitwarden-eso-provider/Chart.yaml - downgrade appversion * helm-docs: automated action --------- Co-authored-by: github-actions[bot] Co-authored-by: JesseBot --- README.md | 4 ++-- charts/bitwarden-eso-provider/Chart.yaml | 4 ++-- charts/bitwarden-eso-provider/README.md | 2 +- .../templates/_helpers.tpl | 16 ++++++++++++++++ .../templates/cluster-secret-stores.yaml | 11 +++++++++++ 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cc2a753..c3dbae0 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ helm install my-release bitwarden-eso-provider/bitwarden-eso-provider --set bitw ``` # Example ExternalSecret -By default we will create two `ClusterSecretStores` for you that can then be accessed when you create a secret like [this](./examples/example-secret.yaml), but also printed below here: +By default we will create three `ClusterSecretStores` for you (logins, fields & notes) that can then be accessed when you create a secret like [this](./examples/example-secret.yaml), but also printed below here: ```yaml --- @@ -116,7 +116,7 @@ spec: property: password ``` -## Testing +## Testing Searching for items has to be done using JSONpath, you will need to install a utility for that, we use [bashtools/JSONPath.sh](https://github.com/bashtools/JSONPath.sh). diff --git a/charts/bitwarden-eso-provider/Chart.yaml b/charts/bitwarden-eso-provider/Chart.yaml index b253540..3bd6193 100644 --- a/charts/bitwarden-eso-provider/Chart.yaml +++ b/charts/bitwarden-eso-provider/Chart.yaml @@ -15,10 +15,10 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.9.0 +version: 0.9.1 # renovate: image=jessebot/bweso -appVersion: "0.8.0" +appVersion: "0.7.0" maintainers: - name: "cloudymax" diff --git a/charts/bitwarden-eso-provider/README.md b/charts/bitwarden-eso-provider/README.md index 0586448..d1d58de 100644 --- a/charts/bitwarden-eso-provider/README.md +++ b/charts/bitwarden-eso-provider/README.md @@ -1,6 +1,6 @@ # bitwarden-eso-provider -![Version: 0.9.0](https://img.shields.io/badge/Version-0.9.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.8.0](https://img.shields.io/badge/AppVersion-0.8.0-informational?style=flat-square) +![Version: 0.9.1](https://img.shields.io/badge/Version-0.9.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.7.0](https://img.shields.io/badge/AppVersion-0.7.0-informational?style=flat-square) Helm chart to use Bitwarden as a Provider for External Secrets Operator diff --git a/charts/bitwarden-eso-provider/templates/_helpers.tpl b/charts/bitwarden-eso-provider/templates/_helpers.tpl index 784ee31..52153ff 100644 --- a/charts/bitwarden-eso-provider/templates/_helpers.tpl +++ b/charts/bitwarden-eso-provider/templates/_helpers.tpl @@ -95,3 +95,19 @@ Create the url string that will be used to query bitwarden {{- define "bitwarden-eso-provider.clusterSecretStore.fieldsJsonPath" -}} {{- printf "$.data.data[0].fields[?(@.name==\"{{ .remoteRef.property }}\")].value" | quote }} {{- end }} + +{{/* +Create the url string that will be used to query Bitwarden: +- cluster-secret-store notes url +*/}} +{{- define "bitwarden-eso-provider.clusterSecretStore.notesUrl" -}} +{{- printf "http://%s.%s.svc.cluster.local:%s/list/object/items?search={{ .remoteRef.key }}" .Release.Name .Release.Namespace (.Values.service.port | toString) | quote }} +{{- end }} + +{{/* +Create the url string that will be used to query bitwarden +- cluster-secret-store notes jsonpath +*/}} +{{- define "bitwarden-eso-provider.clusterSecretStore.notesJsonPath" -}} +{{- printf "$.data.data[0].notes" | quote }} +{{- end }} diff --git a/charts/bitwarden-eso-provider/templates/cluster-secret-stores.yaml b/charts/bitwarden-eso-provider/templates/cluster-secret-stores.yaml index e2f5864..8a359cd 100644 --- a/charts/bitwarden-eso-provider/templates/cluster-secret-stores.yaml +++ b/charts/bitwarden-eso-provider/templates/cluster-secret-stores.yaml @@ -23,4 +23,15 @@ spec: url: {{ include "bitwarden-eso-provider.clusterSecretStore.fieldsUrl" . }} result: jsonPath: {{ include "bitwarden-eso-provider.clusterSecretStore.fieldsJsonPath" . }} +--- +apiVersion: external-secrets.io/v1beta1 +kind: ClusterSecretStore +metadata: + name: bitwarden-notes +spec: + provider: + webhook: + url: {{ include "bitwarden-eso-provider.clusterSecretStore.notesUrl" . }} + result: + jsonPath: {{ include "bitwarden-eso-provider.clusterSecretStore.notesJsonPath" . }} {{- end }}