Skip to content

Commit

Permalink
Merge pull request #86 from chrthal/feature/custom-secret-type
Browse files Browse the repository at this point in the history
Added custom secret type and attachment support for bitwardenSecret
  • Loading branch information
Lerentis authored Jun 22, 2024
2 parents f5b72a1 + cd5ebde commit 297fb37
Show file tree
Hide file tree
Showing 9 changed files with 185 additions and 41 deletions.
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,29 @@ And you are set to create your first secret using this operator. For that you ne

```yaml
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
apiVersion: "lerentis.uploadfilter24.eu/v1beta7"
kind: BitwardenSecret
metadata:
name: name-of-your-management-object
spec:
content:
- element:
secretName: nameOfTheFieldInBitwarden # for example username
secretName: nameOfTheFieldInBitwarden # for example username or filename
secretRef: nameOfTheKeyInTheSecretToBeCreated
secretScope: login # for custom entries on bitwarden use 'fields'
secretScope: login # for custom entries on bitwarden use 'fields, for attachments use attachment'
- element:
secretName: nameOfAnotherFieldInBitwarden # for example password
secretName: nameOfAnotherFieldInBitwarden # for example password or filename
secretRef: nameOfAnotherKeyInTheSecretToBeCreated
secretScope: login # for custom entries on bitwarden use 'fields'
secretScope: login # for custom entries on bitwarden use 'fields, for attachments use attachment'
id: "A Secret ID from bitwarden"
name: "Name of the secret to be created"
secretType: # Optional (Default: Opaque)
namespace: "Namespace of the secret to be created"
labels: # Optional
key: value
annotations: # Optional
key: value
```

The ID can be extracted from the browser when you open a item the ID is in the URL. The resulting secret looks something like this:
Expand Down Expand Up @@ -102,7 +106,7 @@ For managing registry credentials, or pull secrets, you can create another kind

```yaml
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
apiVersion: "lerentis.uploadfilter24.eu/v1beta7"
kind: RegistryCredential
metadata:
name: name-of-your-management-object
Expand All @@ -115,6 +119,8 @@ spec:
namespace: "Namespace of the secret to be created"
labels: # Optional
key: value
annotations: # Optional
key: value
```

The resulting secret looks something like this:
Expand All @@ -141,16 +147,19 @@ One of the more freely defined types that can be used with this operator you can

```yaml
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
apiVersion: "lerentis.uploadfilter24.eu/v1beta7"
kind: BitwardenTemplate
metadata:
name: name-of-your-management-object
spec:
filename: "Key of the secret to be created"
name: "Name of the secret to be created"
secretType: # Optional (Default: Opaque)
namespace: "Namespace of the secret to be created"
labels: # Optional
key: value
annotations: # Optional
key: value
template: |
---
api:
Expand Down
38 changes: 15 additions & 23 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.12.0"
version: "v0.13.0"

appVersion: "0.11.0"
appVersion: "0.12.0"

keywords:
- operator
Expand All @@ -32,22 +32,22 @@ annotations:
url: https://github.com/Lerentis/bitwarden-crd-operator
artifacthub.io/crds: |
- kind: BitwardenSecret
version: v1beta6
version: v1beta7
name: bitwarden-secret
displayName: Bitwarden Secret
description: Management Object to create secrets from bitwarden
- kind: RegistryCredential
version: v1beta6
version: v1beta7
name: registry-credential
displayName: Regestry Credentials
description: Management Object to create regestry secrets from bitwarden
- kind: BitwardenTemplate
version: v1beta6
version: v1beta7
name: bitwarden-template
displayName: Bitwarden Template
description: Management Object to create secrets from a jinja template with a bitwarden lookup
artifacthub.io/crdsExamples: |
- apiVersion: lerentis.uploadfilter24.eu/v1beta6
- apiVersion: lerentis.uploadfilter24.eu/v1beta7
kind: BitwardenSecret
metadata:
name: test
Expand All @@ -61,12 +61,13 @@ annotations:
secretRef: passwordOfUser
id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
name: "test-secret"
secretType: Obaque #Optional
namespace: "default"
labels:
key: value
annotations:
key: value
- apiVersion: lerentis.uploadfilter24.eu/v1beta6
- apiVersion: lerentis.uploadfilter24.eu/v1beta7
kind: RegistryCredential
metadata:
name: test
Expand All @@ -81,13 +82,14 @@ annotations:
key: value
annotations:
key: value
- apiVersion: "lerentis.uploadfilter24.eu/v1beta6"
- apiVersion: "lerentis.uploadfilter24.eu/v1beta7"
kind: BitwardenTemplate
metadata:
name: test
spec:
filename: "config.yaml"
name: "test-regcred"
secretType: Obaque #Optional
namespace: "default"
labels:
key: value
Expand All @@ -107,22 +109,12 @@ annotations:
artifacthub.io/operator: "true"
artifacthub.io/containsSecurityUpdates: "false"
artifacthub.io/changes: |
- kind: changed
description: "Update python to 3.11.9-r0"
- kind: changed
description: "Update Node to 20.12.1-r0"
- kind: changed
description: "Update libcrypto3 to 3.1.4-r5"
- kind: changed
description: "Update alpine to 3.19.1"
- kind: changed
description: "Update kopf to 1.37.2"
- kind: changed
description: "Update jinja to 3.1.4"
- kind: added
description: "Allow custom annotations to generated secrets"
description: "Allow custom type for generated secrets"
- kind: added
description: "Set ownership of generated secrets if CRD is in the same namespace"
description: "Allow attachments in generated secrets"
- kind: added
description: "Allow custom type in templated secrets"
artifacthub.io/images: |
- name: bitwarden-crd-operator
image: ghcr.io/lerentis/bitwarden-crd-operator:0.11.0
image: ghcr.io/lerentis/bitwarden-crd-operator:0.12.0
45 changes: 45 additions & 0 deletions charts/bitwarden-crd-operator/crds/bitwarden-secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,49 @@ spec:
- namespace
- name
- name: v1beta6
served: true
storage: false
deprecated: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
content:
type: array
items:
type: object
properties:
element:
type: object
properties:
secretName:
type: string
secretRef:
type: string
secretScope:
type: string
required:
- secretName
id:
type: string
namespace:
type: string
name:
type: string
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- id
- namespace
- name
- name: v1beta7
served: true
storage: true
schema:
Expand Down Expand Up @@ -122,6 +165,8 @@ spec:
type: string
name:
type: string
secretType:
type: string
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
Expand Down
32 changes: 32 additions & 0 deletions charts/bitwarden-crd-operator/crds/bitwarden-templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,36 @@ spec:
- namespace
- name
- name: v1beta6
served: true
storage: false
deprecated: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
filename:
type: string
template:
type: string
namespace:
type: string
name:
type: string
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- filename
- template
- namespace
- name
- name: v1beta7
served: true
storage: true
schema:
Expand All @@ -82,6 +112,8 @@ spec:
type: string
name:
type: string
secretType:
type: string
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
Expand Down
36 changes: 36 additions & 0 deletions charts/bitwarden-crd-operator/crds/registry-credentials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,42 @@ spec:
- passwordRef
- registry
- name: v1beta6
served: true
storage: false
deprecated: true
schema:
openAPIV3Schema:
type: object
properties:
spec:
type: object
properties:
usernameRef:
type: string
passwordRef:
type: string
registry:
type: string
id:
type: string
namespace:
type: string
name:
type: string
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- id
- namespace
- name
- usernameRef
- passwordRef
- registry
- name: v1beta7
served: true
storage: true
schema:
Expand Down
3 changes: 2 additions & 1 deletion example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta6"
apiVersion: "lerentis.uploadfilter24.eu/v1beta7"
kind: BitwardenSecret
metadata:
name: test
Expand All @@ -16,6 +16,7 @@ spec:
secretScope: login
id: "88781348-c81c-4367-9801-550360c21295"
name: "test-secret"
secretType: Opaque
namespace: "default"
labels:
key: value
Expand Down
2 changes: 1 addition & 1 deletion skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ deploy:
chartPath: charts/bitwarden-crd-operator
valuesFiles:
- env/values.yaml
version: v0.7.4
version: v0.13.0
Loading

0 comments on commit 297fb37

Please sign in to comment.