Skip to content

Commit

Permalink
Merge pull request #61 from Lerentis/Lerentis/issue60
Browse files Browse the repository at this point in the history
Labels for Secrets and updates
  • Loading branch information
Lerentis authored Jan 6, 2024
2 parents e31899b + 9f4264d commit a2186ab
Show file tree
Hide file tree
Showing 12 changed files with 203 additions and 37 deletions.
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM alpine:3.18.3
FROM alpine:3.19.0

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.11.6-r0
ARG PIP_VERSION=23.1.2-r0
ARG GCOMPAT_VERSION=1.1.0-r1
ARG LIBCRYPTO_VERSION=3.1.2-r0
ARG PYTHON_VERSION=3.11.6-r1
ARG PIP_VERSION=23.3.1-r0
ARG GCOMPAT_VERSION=1.1.0-r4
ARG LIBCRYPTO_VERSION=3.1.4-r2
ARG BW_VERSION=2023.1.0

COPY requirements.txt /requirements.txt
Expand Down Expand Up @@ -38,7 +38,7 @@ RUN set -eux; \
mkdir -p /home/bw-operator; \
chown -R bw-operator /home/bw-operator; \
apk add gcc musl-dev libstdc++ gcompat=${GCOMPAT_VERSION} python3=${PYTHON_VERSION} py3-pip=${PIP_VERSION} libcrypto3=${LIBCRYPTO_VERSION}; \
pip install -r /requirements.txt --no-warn-script-location; \
pip install -r /requirements.txt --no-warn-script-location --break-system-packages; \
rm /requirements.txt; \
apk del --purge gcc musl-dev libstdc++;

Expand Down
18 changes: 15 additions & 3 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/v1beta4"
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
kind: BitwardenSecret
metadata:
name: name-of-your-management-object
Expand All @@ -73,6 +73,8 @@ spec:
id: "A Secret ID from bitwarden"
name: "Name of the secret to be created"
namespace: "Namespace of the secret to be created"
labels: # 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 All @@ -87,6 +89,8 @@ metadata:
annotations:
managed: bitwarden-secrets.lerentis.uploadfilter24.eu
managedObject: bw-operator/test
labels:
key: value
name: name-of-your-management-object
namespace: default
type: Opaque
Expand All @@ -98,7 +102,7 @@ For managing registry credentials, or pull secrets, you can create another kind

```yaml
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta4"
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
kind: RegistryCredential
metadata:
name: name-of-your-management-object
Expand All @@ -109,6 +113,8 @@ spec:
id: "A Secret ID from bitwarden"
name: "Name of the secret to be created"
namespace: "Namespace of the secret to be created"
labels: # Optional
key: value
```

The resulting secret looks something like this:
Expand All @@ -122,6 +128,8 @@ metadata:
annotations:
managed: bitwarden-secrets.lerentis.uploadfilter24.eu
managedObject: bw-operator/test
labels:
key: value
name: name-of-your-management-object
namespace: default
type: dockerconfigjson
Expand All @@ -133,14 +141,16 @@ One of the more freely defined types that can be used with this operator you can

```yaml
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta4"
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
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"
namespace: "Namespace of the secret to be created"
labels: # Optional
key: value
template: |
---
api:
Expand All @@ -164,6 +174,8 @@ metadata:
annotations:
managed: bitwarden-template.lerentis.uploadfilter24.eu
managedObject: namespace/name-of-your-management-object
labels:
key: value
name: Name of the secret to be created
namespace: Namespace of the secret to be created
type: Opaque
Expand Down
38 changes: 27 additions & 11 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.10.1"
version: "v0.11.0"

appVersion: "0.9.1"
appVersion: "0.10.0"

keywords:
- operator
Expand All @@ -32,22 +32,22 @@ annotations:
url: https://github.com/Lerentis/bitwarden-crd-operator
artifacthub.io/crds: |
- kind: BitwardenSecret
version: v1beta4
version: v1beta5
name: bitwarden-secret
displayName: Bitwarden Secret
description: Management Object to create secrets from bitwarden
- kind: RegistryCredential
version: v1beta4
version: v1beta5
name: registry-credential
displayName: Regestry Credentials
description: Management Object to create regestry secrets from bitwarden
- kind: BitwardenTemplate
version: v1beta1
version: v1beta5
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/v1beta4
- apiVersion: lerentis.uploadfilter24.eu/v1beta5
kind: BitwardenSecret
metadata:
name: test
Expand All @@ -62,7 +62,9 @@ annotations:
id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
name: "test-secret"
namespace: "default"
- apiVersion: lerentis.uploadfilter24.eu/v1beta4
labels:
key: value
- apiVersion: lerentis.uploadfilter24.eu/v1beta5
kind: RegistryCredential
metadata:
name: test
Expand All @@ -73,14 +75,18 @@ annotations:
id: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"
name: "test-regcred"
namespace: "default"
- apiVersion: "lerentis.uploadfilter24.eu/v1beta4"
labels:
key: value
- apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
kind: BitwardenTemplate
metadata:
name: test
spec:
filename: "config.yaml"
name: "test-regcred"
namespace: "default"
labels:
key: value
template: |
---
api:
Expand All @@ -95,8 +101,18 @@ annotations:
artifacthub.io/operator: "true"
artifacthub.io/containsSecurityUpdates: "false"
artifacthub.io/changes: |
- kind: fixed
description: "Fixed type and content of RegistryCredential"
- kind: changed
description: "Added the possibility to add labels to generated secrets"
- kind: changed
description: "Updated Alpine to 3.19.0"
- kind: changed
description: "Update Python to 3.11.6-r1"
- kind: changed
description: "Update pip to 23.3.1-r0"
- kind: changed
description: "Update gcompat to 1.1.0-r4"
- kind: changed
description: "Update libcrypto3 to 3.1.4-r2"
artifacthub.io/images: |
- name: bitwarden-crd-operator
image: ghcr.io/lerentis/bitwarden-crd-operator:0.9.1
image: ghcr.io/lerentis/bitwarden-crd-operator:0.10.0
40 changes: 40 additions & 0 deletions charts/bitwarden-crd-operator/crds/bitwarden-secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,43 @@ spec:
- 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
served: true
storage: true
schema:
Expand Down Expand Up @@ -45,6 +82,9 @@ spec:
type: string
name:
type: string
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- id
- namespace
Expand Down
27 changes: 27 additions & 0 deletions charts/bitwarden-crd-operator/crds/bitwarden-templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@ spec:
- bwt
versions:
- name: v1beta4
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
required:
- filename
- template
- namespace
- name
- name: v1beta5
served: true
storage: true
schema:
Expand All @@ -31,6 +55,9 @@ spec:
type: string
name:
type: string
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- filename
- template
Expand Down
33 changes: 33 additions & 0 deletions charts/bitwarden-crd-operator/crds/registry-credentials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,36 @@ spec:
- rgc
versions:
- name: v1beta4
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
required:
- id
- namespace
- name
- usernameRef
- passwordRef
- registry
- name: v1beta5
served: true
storage: true
schema:
Expand All @@ -35,6 +65,9 @@ spec:
type: string
name:
type: string
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- id
- namespace
Expand Down
7 changes: 5 additions & 2 deletions example.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta4"
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
kind: BitwardenSecret
metadata:
name: test
Expand All @@ -16,8 +16,11 @@ spec:
id: "88781348-c81c-4367-9801-550360c21295"
name: "test-secret"
namespace: "default"
labels:
key: value
app: example-app
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta4"
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
kind: BitwardenSecret
metadata:
name: test-scope
Expand Down
7 changes: 5 additions & 2 deletions example_dockerlogin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta4"
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
kind: RegistryCredential
metadata:
name: test
Expand All @@ -9,4 +9,7 @@ spec:
registry: "docker.io"
id: "3b249ec7-9ce7-440a-9558-f34f3ab10680"
name: "test-regcred"
namespace: "default"
namespace: "default"
labels:
namespace: default
tenant: example-team
5 changes: 4 additions & 1 deletion example_template.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta4"
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
kind: BitwardenTemplate
metadata:
name: test
spec:
filename: "config.yaml"
name: "test-template"
namespace: "default"
labels:
key: value
app: example-app
template: |
---
api:
Expand Down
Loading

0 comments on commit a2186ab

Please sign in to comment.