Skip to content

Commit

Permalink
Merge pull request #82 from Lerentis/feature/tt/ownership-and-annotat…
Browse files Browse the repository at this point in the history
…ions

Set Ownership and allow custom Annotations
  • Loading branch information
Lerentis authored May 18, 2024
2 parents 1820bd0 + b01f410 commit f679aa1
Show file tree
Hide file tree
Showing 15 changed files with 228 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: Get app version from chart
uses: mikefarah/yq@v4.43.1
uses: mikefarah/yq@v4.44.1
id: app_version
with:
cmd: yq '.appVersion' charts/bitwarden-crd-operator/Chart.yaml
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
FROM alpine:3.19.0
FROM alpine:3.19.1

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.8-r0
ARG PYTHON_VERSION=3.11.9-r0
ARG PIP_VERSION=23.3.1-r0
ARG GCOMPAT_VERSION=1.1.0-r4
ARG LIBCRYPTO_VERSION=3.1.4-r2
ARG LIBCRYPTO_VERSION=3.1.4-r5
ARG BW_VERSION=2023.7.0
ARG NODE_VERSION=20.11.1-r0
ARG NODE_VERSION=20.12.1-r0

COPY requirements.txt /requirements.txt

Expand Down
40 changes: 28 additions & 12 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.11.3"
version: "v0.12.0"

appVersion: "0.10.3"
appVersion: "0.11.0"

keywords:
- operator
Expand All @@ -32,22 +32,22 @@ annotations:
url: https://github.com/Lerentis/bitwarden-crd-operator
artifacthub.io/crds: |
- kind: BitwardenSecret
version: v1beta5
version: v1beta6
name: bitwarden-secret
displayName: Bitwarden Secret
description: Management Object to create secrets from bitwarden
- kind: RegistryCredential
version: v1beta5
version: v1beta6
name: registry-credential
displayName: Regestry Credentials
description: Management Object to create regestry secrets from bitwarden
- kind: BitwardenTemplate
version: v1beta5
version: v1beta6
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/v1beta5
- apiVersion: lerentis.uploadfilter24.eu/v1beta6
kind: BitwardenSecret
metadata:
name: test
Expand All @@ -64,7 +64,9 @@ annotations:
namespace: "default"
labels:
key: value
- apiVersion: lerentis.uploadfilter24.eu/v1beta5
annotations:
key: value
- apiVersion: lerentis.uploadfilter24.eu/v1beta6
kind: RegistryCredential
metadata:
name: test
Expand All @@ -77,7 +79,9 @@ annotations:
namespace: "default"
labels:
key: value
- apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
annotations:
key: value
- apiVersion: "lerentis.uploadfilter24.eu/v1beta6"
kind: BitwardenTemplate
metadata:
name: test
Expand All @@ -87,6 +91,8 @@ annotations:
namespace: "default"
labels:
key: value
annotations:
key: value
template: |
---
api:
Expand All @@ -102,11 +108,21 @@ annotations:
artifacthub.io/containsSecurityUpdates: "false"
artifacthub.io/changes: |
- kind: changed
description: "Update python to 3.11.8-r0"
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 Node to 20.11.1-r0"
description: "Update kopf to 1.37.2"
- kind: changed
description: "Unified bw cli installation methode"
description: "Update jinja to 3.1.4"
- kind: added
description: "Allow custom annotations to generated secrets"
- kind: added
description: "Set ownership of generated secrets if CRD is in the same namespace"
artifacthub.io/images: |
- name: bitwarden-crd-operator
image: ghcr.io/lerentis/bitwarden-crd-operator:0.10.3
image: ghcr.io/lerentis/bitwarden-crd-operator:0.11.0
45 changes: 44 additions & 1 deletion charts/bitwarden-crd-operator/crds/bitwarden-secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ spec:
- name
- name: v1beta5
served: true
storage: true
storage: false
deprecated: true
schema:
openAPIV3Schema:
type: object
Expand Down Expand Up @@ -89,3 +90,45 @@ spec:
- id
- namespace
- name
- name: v1beta6
served: true
storage: 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
30 changes: 30 additions & 0 deletions charts/bitwarden-crd-operator/crds/bitwarden-templates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,33 @@ spec:
- namespace
- name
- name: v1beta5
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
required:
- filename
- template
- namespace
- name
- name: v1beta6
served: true
storage: true
schema:
Expand All @@ -58,6 +85,9 @@ spec:
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- filename
- template
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 @@ -44,6 +44,39 @@ spec:
- passwordRef
- registry
- name: v1beta5
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
required:
- id
- namespace
- name
- usernameRef
- passwordRef
- registry
- name: v1beta6
served: true
storage: true
schema:
Expand All @@ -68,6 +101,9 @@ spec:
labels:
type: object
x-kubernetes-preserve-unknown-fields: true
annotations:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- id
- namespace
Expand Down
2 changes: 2 additions & 0 deletions charts/bitwarden-crd-operator/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
strategy:
type: {{ .Values.deploymentStrategy }}
selector:
matchLabels:
{{- include "bitwarden-crd-operator.selectorLabels" . | nindent 6 }}
Expand Down
2 changes: 2 additions & 0 deletions charts/bitwarden-crd-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

deploymentStrategy: "Recreate"

# env:
# - name: BW_FORCE_SYNC
# value: "false"
Expand Down
7 changes: 5 additions & 2 deletions example.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
apiVersion: "lerentis.uploadfilter24.eu/v1beta6"
kind: BitwardenSecret
metadata:
name: test
namespace: default
spec:
content:
- element:
Expand All @@ -19,8 +20,10 @@ spec:
labels:
key: value
app: example-app
annotations:
custom.annotation: is-used
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
apiVersion: "lerentis.uploadfilter24.eu/v1beta6"
kind: BitwardenSecret
metadata:
name: test-scope
Expand Down
6 changes: 4 additions & 2 deletions example_dockerlogin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
apiVersion: "lerentis.uploadfilter24.eu/v1beta6"
kind: RegistryCredential
metadata:
name: test
Expand All @@ -12,4 +12,6 @@ spec:
namespace: "default"
labels:
namespace: default
tenant: example-team
tenant: example-team
annotations:
custom.annotation: is-used
4 changes: 3 additions & 1 deletion example_template.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
apiVersion: "lerentis.uploadfilter24.eu/v1beta5"
apiVersion: "lerentis.uploadfilter24.eu/v1beta6"
kind: BitwardenTemplate
metadata:
name: test
Expand All @@ -10,6 +10,8 @@ spec:
labels:
key: value
app: example-app
annotations:
custom.annotation: is-used
template: |
---
api:
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
kopf==1.37.1
kopf==1.37.2
kubernetes==29.0.0
Jinja2==3.1.3
Jinja2==3.1.4
schedule==1.2.1
Loading

0 comments on commit f679aa1

Please sign in to comment.