Skip to content

Commit

Permalink
feat: added bitwarden-webhook
Browse files Browse the repository at this point in the history
Signed-off-by: Mateusz Urbanek <[email protected]>
  • Loading branch information
shanduur committed Jun 4, 2024
1 parent efdb40b commit f93b3fd
Show file tree
Hide file tree
Showing 11 changed files with 386 additions and 3 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/semantic-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
scopes: bitwarden-webhook
sidero-omni
requireScope: true
subjectPattern: ^(?![A-Z]).+$
23 changes: 23 additions & 0 deletions anza-labs/bitwarden-webhook/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
2 changes: 1 addition & 1 deletion anza-labs/bitwarden-webhook/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: bitwarden-webhook
description: A BitWarden Webhook provider for External Secrets Operator
type: application
version: 0.1.0
version: 1.0.0
39 changes: 39 additions & 0 deletions anza-labs/bitwarden-webhook/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# bitwarden-webhook

![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat)

A BitWarden Webhook provider for External Secrets Operator

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity settings for the pods. |
| fullnameOverride | string | `""` | Override for the full name. |
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy. |
| image.repository | string | `"ghcr.io/charlesthomas/bitwarden-cli"` | Registry and repository for the image. |
| image.tag | string | `"2023.12.1"` | Tag for the image. |
| imagePullSecrets | list | `[]` | Secrets for pulling images. |
| nameOverride | string | `""` | Override for the name. |
| networkPolicy.create | bool | `true` | Specifies whether a network policy should be created. |
| networkPolicy.podSelectors | list | `[{"app.kubernetes.io/instance":"external-secrets","app.kubernetes.io/name":"external-secrets"}]` | Pod selectors for the network policy. |
| nodeSelector | object | `{}` | Node selector for the pods. |
| podAnnotations | object | `{}` | Annotations to be added to the pods. |
| podLabels | object | `{}` | Labels to be added to the pods. |
| podSecurityContext | object | `{}` | |
| replicaCount | int | `1` | Number of replicas for the deployment. |
| resources | object | `{}` | |
| secret.bitwardenHost | string | `""` | Host for Bitwarden. |
| secret.bitwardenPassword | string | `""` | Password for Bitwarden. |
| secret.bitwardenUsername | string | `""` | Username for Bitwarden. |
| secret.create | bool | `true` | Specifies whether a secret should be created. |
| secret.existingSecretName | string | `""` | Name of the existing secret. |
| securityContext | object | `{}` | |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account. |
| serviceAccount.automount | bool | `true` | Automatically mount a ServiceAccount's API credentials. |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created. |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template. |
| tolerations | list | `[]` | Tolerations for the pods. |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1)
73 changes: 73 additions & 0 deletions anza-labs/bitwarden-webhook/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "bitwarden-webhook.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "bitwarden-webhook.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "bitwarden-webhook.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "bitwarden-webhook.labels" -}}
helm.sh/chart: {{ include "bitwarden-webhook.chart" . }}
{{ include "bitwarden-webhook.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "bitwarden-webhook.selectorLabels" -}}
app.kubernetes.io/name: {{ include "bitwarden-webhook.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "bitwarden-webhook.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "bitwarden-webhook.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Create the name of the secret to use
*/}}
{{- define "bitwarden-webhook.secretName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "bitwarden-webhook.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- required ".Values.secret.existingSecretName is required when not creating the secret!" .Values.secret.existingSecretName }}
{{- end }}
{{- end }}
94 changes: 94 additions & 0 deletions anza-labs/bitwarden-webhook/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "bitwarden-webhook.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "bitwarden-webhook.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "bitwarden-webhook.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "bitwarden-webhook.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "bitwarden-webhook.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: BW_HOST
valueFrom:
secretKeyRef:
name: {{ include "bitwarden-webhook.secretName" . }}
key: BW_HOST
- name: BW_USER
valueFrom:
secretKeyRef:
name: {{ include "bitwarden-webhook.secretName" . }}
key: BW_USERNAME
- name: BW_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "bitwarden-webhook.secretName" . }}
key: BW_PASSWORD
ports:
- name: http
containerPort: 8087
protocol: TCP
livenessProbe:
exec:
command:
- wget
- -q
- http://127.0.0.1:8087/sync?force=true
- --post-data=''
initialDelaySeconds: 20
failureThreshold: 3
timeoutSeconds: 1
periodSeconds: 120
readinessProbe:
tcpSocket:
port: 8087
initialDelaySeconds: 20
failureThreshold: 3
timeoutSeconds: 1
periodSeconds: 10
startupProbe:
tcpSocket:
port: 8087
initialDelaySeconds: 10
failureThreshold: 30
timeoutSeconds: 1
periodSeconds: 5
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
20 changes: 20 additions & 0 deletions anza-labs/bitwarden-webhook/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.networkPolicy.create -}}
kind: NetworkPolicy
apiVersion: networking.k8s.io/v1
metadata:
name: {{ include "bitwarden-webhook.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "bitwarden-webhook.labels" . | nindent 4 }}
spec:
podSelector:
matchLabels:
{{- include "bitwarden-webhook.selectorLabels" . | nindent 6 }}
ingress:
- from:
{{- range $v := .Values.networkPolicy.podSelectors }}
- podSelector:
matchLabels:
{{- $v | toYaml | nindent 12 }}
{{- end }}
{{- end }}
20 changes: 20 additions & 0 deletions anza-labs/bitwarden-webhook/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.secret.create -}}
{{- $bitwardenHost := .Values.secret.bitwardenHost | required ".Values.secret.bitwardenHost is required." -}}
{{- $bitwardenUsername := .Values.secret.bitwardenUsername | required ".Values.secret.bitwardenUsername is required." -}}
{{- $bitwardenPassword := .Values.secret.bitwardenPassword | required ".Values.secret.bitwardenPassword is required." -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "bitwarden-webhook.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "bitwarden-webhook.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
type: Opaque
stringData:
BW_HOST: {{ $bitwardenHost }}
BW_USERNAME: {{ $bitwardenUsername }}
BW_PASSWORD: {{ $bitwardenPassword }}
{{- end }}
16 changes: 16 additions & 0 deletions anza-labs/bitwarden-webhook/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "bitwarden-webhook.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "bitwarden-webhook.labels" . | nindent 4 }}
spec:
type: ClusterIP
ports:
- port: 8087
targetPort: http
protocol: TCP
name: http
selector:
{{- include "bitwarden-webhook.selectorLabels" . | nindent 4 }}
14 changes: 14 additions & 0 deletions anza-labs/bitwarden-webhook/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "bitwarden-webhook.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "bitwarden-webhook.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
automountServiceAccountToken: {{ .Values.serviceAccount.automount }}
{{- end }}
Loading

0 comments on commit f93b3fd

Please sign in to comment.