adding new git-ops structure
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: bitwarden-cli
|
||||
namespace: infra
|
||||
labels:
|
||||
app.kubernetes.io/name: bitwarden-cli
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: bitwarden-cli
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: bitwarden-cli
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
containers:
|
||||
- name: bitwarden-cli
|
||||
image: ghcr.io/charlesthomas/bitwarden-cli:2026.7.0
|
||||
imagePullPolicy: IfNotPresent
|
||||
# Override the baked entrypoint so --disable-origin-protection is
|
||||
# actually passed (it was commented out in the image's entrypoint.sh,
|
||||
# which made bw serve reject all cross-pod requests -> connection refused).
|
||||
command: ["/bin/bash", "-lc"]
|
||||
args:
|
||||
- |
|
||||
set -e
|
||||
bw config server "${BW_HOST}"
|
||||
|
||||
# Authenticate. Prefer the API key if client creds are present.
|
||||
login() {
|
||||
if [ -n "$BW_CLIENTID" ] && [ -n "$BW_CLIENTSECRET" ]; then
|
||||
echo "Using apikey to log in"
|
||||
BW_SESSION=$(bw login --apikey --raw) || return 1
|
||||
else
|
||||
echo "Using password to log in"
|
||||
BW_SESSION=$(bw login "${BW_USER}" --passwordenv BW_PASSWORD --raw) || return 1
|
||||
fi
|
||||
export BW_SESSION
|
||||
}
|
||||
|
||||
login
|
||||
|
||||
# Warm the vault cache once at startup so bw serve has data immediately.
|
||||
bw sync
|
||||
bw status
|
||||
|
||||
# Keep the session alive
|
||||
|
||||
echo "Starting periodic bw login+sync loop (every 5m)"
|
||||
(
|
||||
while true; do
|
||||
sleep 300
|
||||
login || true
|
||||
echo "[$(date -u +%FT%TZ)] bw sync"
|
||||
bw sync >/dev/null 2>&1 || echo "[$(date -u +%FT%TZ)] bw sync failed"
|
||||
done
|
||||
) &
|
||||
|
||||
echo 'Running `bw serve` on port 8087'
|
||||
bw serve --hostname 0.0.0.0 --disable-origin-protection
|
||||
env:
|
||||
- name: BW_HOST
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: bitwarden-cli
|
||||
key: BW_HOST
|
||||
- name: BW_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: bitwarden-cli
|
||||
key: BW_USERNAME
|
||||
- name: BW_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: bitwarden-cli
|
||||
key: BW_PASSWORD
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8087
|
||||
protocol: TCP
|
||||
startupProbe:
|
||||
tcpSocket: { port: 8087 }
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 30
|
||||
readinessProbe:
|
||||
tcpSocket: { port: 8087 }
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
livenessProbe:
|
||||
tcpSocket: { port: 8087 }
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 6
|
||||
resources:
|
||||
limits:
|
||||
cpu: 400m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 128Mi
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: bitwarden-cli
|
||||
namespace: infra
|
||||
labels:
|
||||
app.kubernetes.io/name: bitwarden-cli
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app.kubernetes.io/name: bitwarden-cli
|
||||
ports:
|
||||
- name: http
|
||||
port: 8087
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: bw-cli
|
||||
namespace: infra
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: bitwarden-cli
|
||||
policyTypes:
|
||||
- Ingress
|
||||
ingress:
|
||||
- from:
|
||||
# ESO pods in the external-secrets namespace.
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: external-secrets
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: external-secrets
|
||||
Reference in New Issue
Block a user