Skip to content

Commit

Permalink
Merge pull request #97 from Lerentis/feature/tt/refactor-templates
Browse files Browse the repository at this point in the history
(feat): refactor bitwardenTemplate to handle more than one file
  • Loading branch information
Lerentis authored Oct 6, 2024
2 parents 25b1d07 + 90a3e9f commit 3efa4e6
Show file tree
Hide file tree
Showing 11 changed files with 271 additions and 266 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM alpine:3.20.2
FROM alpine:3.20.3

LABEL org.opencontainers.image.source=https://github.com/Lerentis/bitwarden-crd-operator
LABEL org.opencontainers.image.description="Kubernetes Operator to create k8s secrets from bitwarden"
LABEL org.opencontainers.image.licenses=MIT

ARG PYTHON_VERSION=3.12.3-r1
ARG PYTHON_VERSION=3.12.6-r0
ARG PIP_VERSION=24.0-r2
ARG GCOMPAT_VERSION=1.1.0-r4
ARG LIBCRYPTO_VERSION=3.3.1-r3
ARG LIBCRYPTO_VERSION=3.3.2-r0
ARG BW_VERSION=2024.7.2
ARG NODE_VERSION=20.15.1-r0

Expand Down
42 changes: 28 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ And you are set to create your first secret using this operator. For that you ne

```yaml
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta7"
apiVersion: "lerentis.uploadfilter24.eu/v1beta8"
kind: BitwardenSecret
metadata:
name: name-of-your-management-object
Expand Down Expand Up @@ -106,7 +106,7 @@ For managing registry credentials, or pull secrets, you can create another kind

```yaml
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta7"
apiVersion: "lerentis.uploadfilter24.eu/v1beta8"
kind: RegistryCredential
metadata:
name: name-of-your-management-object
Expand Down Expand Up @@ -147,29 +147,43 @@ One of the more freely defined types that can be used with this operator you can

```yaml
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta7"
apiVersion: "lerentis.uploadfilter24.eu/v1beta8"
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:
enabled: True
key: {{ bitwarden_lookup("A Secret ID from bitwarden", "login or fields or attachment", "name of a field in bitwarden") }}
allowCrossOrigin: false
apps:
"some.app.identifier:some_version":
pubkey: {{ bitwarden_lookup("A Secret ID from bitwarden", "login or fields or attachment", "name of a field in bitwarden") }}
enabled: true
content:
- element:
filename: config.yaml
template: |
---
api:
enabled: True
key: {{ bitwarden_lookup("A Secret ID from bitwarden", "login or fields or attachment", "name of a field in bitwarden") }}
allowCrossOrigin: false
apps:
"some.app.identifier:some_version":
pubkey: {{ bitwarden_lookup("A Secret ID from bitwarden", "login or fields or attachment", "name of a field in bitwarden") }}
enabled: true
- element:
filename: config2.yaml
template: |
---
api:
enabled: True
key: {{ bitwarden_lookup("A Secret ID from bitwarden", "login or fields or attachment", "name of a field in bitwarden") }}
allowCrossOrigin: false
apps:
"some.app.identifier:some_version":
pubkey: {{ bitwarden_lookup("A Secret ID from bitwarden", "login or fields or attachment", "name of a field in bitwarden") }}
enabled: false
```

This will result in something like the following object:
Expand Down
57 changes: 28 additions & 29 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.14.0"
version: "v0.15.0"

appVersion: "0.13.0"
appVersion: "0.14.0"

keywords:
- operator
Expand All @@ -20,7 +20,7 @@ home: https://lerentis.github.io/bitwarden-crd-operator/
sources:
- https://github.com/Lerentis/bitwarden-crd-operator

kubeVersion: ">= 1.23.0-0"
kubeVersion: ">= 1.28.0-0"

maintainers:
- name: lerentis
Expand All @@ -32,22 +32,22 @@ annotations:
url: https://github.com/Lerentis/bitwarden-crd-operator
artifacthub.io/crds: |
- kind: BitwardenSecret
version: v1beta7
version: v1beta8
name: bitwarden-secret
displayName: Bitwarden Secret
description: Management Object to create secrets from bitwarden
- kind: RegistryCredential
version: v1beta7
version: v1beta8
name: registry-credential
displayName: Regestry Credentials
description: Management Object to create regestry secrets from bitwarden
- kind: BitwardenTemplate
version: v1beta7
version: v1beta8
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/v1beta7
- apiVersion: lerentis.uploadfilter24.eu/v1beta8
kind: BitwardenSecret
metadata:
name: test
Expand All @@ -67,7 +67,7 @@ annotations:
key: value
annotations:
key: value
- apiVersion: lerentis.uploadfilter24.eu/v1beta7
- apiVersion: lerentis.uploadfilter24.eu/v1beta8
kind: RegistryCredential
metadata:
name: test
Expand All @@ -82,45 +82,44 @@ annotations:
key: value
annotations:
key: value
- apiVersion: "lerentis.uploadfilter24.eu/v1beta7"
- apiVersion: "lerentis.uploadfilter24.eu/v1beta8"
kind: BitwardenTemplate
metadata:
name: test
spec:
filename: "config.yaml"
name: "test-regcred"
secretType: Obaque #Optional
namespace: "default"
labels:
key: value
annotations:
key: value
template: |
---
api:
enabled: True
key: {{ bitwarden_lookup("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "fields", "key") }}
allowCrossOrigin: false
apps:
"some.app.identifier:some_version":
pubkey: {{ bitwarden_lookup("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "attachment", "public_key") }}
enabled: true
content:
- element:
filename: "config.yaml"
template: |
---
api:
enabled: True
key: {{ bitwarden_lookup("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "fields", "key") }}
allowCrossOrigin: false
apps:
"some.app.identifier:some_version":
pubkey: {{ bitwarden_lookup("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", "attachment", "public_key") }}
enabled: true
artifacthub.io/license: MIT
artifacthub.io/operator: "true"
artifacthub.io/containsSecurityUpdates: "false"
artifacthub.io/changes: |
- kind: changed
description: "Update Alpine to 3.20.2"
- kind: changed
description: "Update Python to 3.12.3-r1"
- kind: changed
description: "Update Pip to 24.0-r2"
description: "BitwardenTemplate can now handle multiple files"
- kind: changed
description: "Update NodeJS to 20.15.1-r0"
description: "Removed long deprecated versions"
- kind: changed
description: "Update libcrypto3 to 3.3.1-r3"
description: "Update kubernetes from v29.0.0 to v30.1.0"
- kind: changed
description: "Update BitwardenCLI to 2024.7.2"
description: "Update alpine from 3.20.2 to 3.20.3"
artifacthub.io/images: |
- name: bitwarden-crd-operator
image: ghcr.io/lerentis/bitwarden-crd-operator:0.13.0
image: ghcr.io/lerentis/bitwarden-crd-operator:0.14.0
81 changes: 3 additions & 78 deletions charts/bitwarden-crd-operator/crds/bitwarden-secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,7 @@ spec:
shortNames:
- bws
versions:
- name: v1beta4
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
required:
- id
- namespace
- name
- name: v1beta5
- name: v1beta7
served: true
storage: false
deprecated: true
Expand Down Expand Up @@ -83,45 +46,7 @@ spec:
type: string
name:
type: string
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- id
- 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:
secretType:
type: string
labels:
type: object
Expand All @@ -133,7 +58,7 @@ spec:
- id
- namespace
- name
- name: v1beta7
- name: v1beta8
served: true
storage: true
schema:
Expand Down
Loading

0 comments on commit 3efa4e6

Please sign in to comment.