feat: add OSINT Dashboard Kubernetes infrastructure
- Helm chart scaffold (Chart.yaml, values.yaml, _helpers.tpl) - Namespace + RBAC manifests - PostgreSQL (CNPG, 3 replicas, PostGIS + TimescaleDB) - NATS JetStream (3 replicas, persistent, custom subjects) - Redis Sentinel (1 primary + 2 replicas, HA) - MinIO distributed (4 replicas, bucket init job) - Gateway API HTTPRoute + cert-manager TLS certificates - Monitoring stack (Prometheus, Grafana, Alertmanager, exporters) - NetworkPolicies (default deny + per-component policies) - GitHub Actions CI/CD pipeline (lint, template, security scan) - Flux CD staging overlay
This commit is contained in:
parent
36b1d637f1
commit
8255467313
31 changed files with 2818 additions and 0 deletions
70
apps/base/osint-dashboard/templates/redis/configmap.yaml
Normal file
70
apps/base/osint-dashboard/templates/redis/configmap.yaml
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
{{- if .Values.redis.enabled }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: redis-config
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
data:
|
||||
redis.conf: |
|
||||
bind 0.0.0.0
|
||||
port {{ .Values.redis.ports.redis }}
|
||||
appendonly yes
|
||||
appendfilename "appendonly.aof"
|
||||
dir /data
|
||||
save 900 1
|
||||
save 300 10
|
||||
save 60 10000
|
||||
maxmemory-policy allkeys-lru
|
||||
# Require authentication
|
||||
requirepass CHANGE_ME_USE_SOPS
|
||||
masterauth CHANGE_ME_USE_SOPS
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: redis-sentinel-config
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
data:
|
||||
sentinel.conf: |
|
||||
port {{ .Values.redis.ports.sentinel }}
|
||||
sentinel monitor osint-redis-master redis-master.{{ .Values.namespace }}.svc {{ .Values.redis.ports.redis }} 2
|
||||
sentinel auth-pass osint-redis-master CHANGE_ME_USE_SOPS
|
||||
sentinel down-after-milliseconds osint-redis-master 5000
|
||||
sentinel failover-timeout osint-redis-master 30000
|
||||
sentinel parallel-syncs osint-redis-master 1
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: redis-scripts
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
data:
|
||||
init-sentinel.sh: |
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Copy sentinel config and update it with current master info
|
||||
cp /etc/redis-sentinel/sentinel.conf /tmp/sentinel.conf
|
||||
# Sentinel will auto-discover master from other sentinels
|
||||
exec redis-sentinel /tmp/sentinel.conf --loglevel notice
|
||||
redis.sh: |
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
REDIS_PORT={{ .Values.redis.ports.redis }}
|
||||
REDIS_PASSWORD="CHANGE_ME_USE_SOPS"
|
||||
|
||||
if [ "${REDIS_ROLE}" = "master" ]; then
|
||||
exec redis-server /etc/redis/redis.conf
|
||||
else
|
||||
# Replica: find master and replicate
|
||||
MASTER_HOST="redis-master.{{ .Values.namespace }}.svc"
|
||||
exec redis-server /etc/redis/redis.conf --replicaof ${MASTER_HOST} ${REDIS_PORT}
|
||||
fi
|
||||
{{- end }}
|
||||
61
apps/base/osint-dashboard/templates/redis/service.yaml
Normal file
61
apps/base/osint-dashboard/templates/redis/service.yaml
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{{- if .Values.redis.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: redis-master
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: redis
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {{ .Values.redis.ports.redis }}
|
||||
targetPort: {{ .Values.redis.ports.redis }}
|
||||
protocol: TCP
|
||||
name: redis
|
||||
selector:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: redis
|
||||
redis-role: master
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: redis-replica
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: redis
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {{ .Values.redis.ports.redis }}
|
||||
targetPort: {{ .Values.redis.ports.redis }}
|
||||
protocol: TCP
|
||||
name: redis
|
||||
selector:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: redis
|
||||
redis-role: replica
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: redis-sentinel
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: redis
|
||||
spec:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
- port: {{ .Values.redis.ports.sentinel }}
|
||||
targetPort: {{ .Values.redis.ports.sentinel }}
|
||||
protocol: TCP
|
||||
name: sentinel
|
||||
selector:
|
||||
app.kubernetes.io/name: osint-dashboard
|
||||
app.kubernetes.io/component: redis
|
||||
redis-role: sentinel
|
||||
{{- end }}
|
||||
210
apps/base/osint-dashboard/templates/redis/statefulset.yaml
Normal file
210
apps/base/osint-dashboard/templates/redis/statefulset.yaml
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
{{- if .Values.redis.enabled }}
|
||||
# Redis Master
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: redis-master
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: redis
|
||||
redis-role: master
|
||||
spec:
|
||||
serviceName: redis-master
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "osint-dashboard.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: redis
|
||||
redis-role: master
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "osint-dashboard.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: redis
|
||||
redis-role: master
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9121"
|
||||
spec:
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 999
|
||||
fsGroup: 999
|
||||
containers:
|
||||
- name: redis
|
||||
image: "{{ .Values.redis.image.repository }}:{{ .Values.redis.image.tag }}"
|
||||
ports:
|
||||
- name: redis
|
||||
containerPort: {{ .Values.redis.ports.redis }}
|
||||
resources:
|
||||
{{- toYaml .Values.redis.master.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/redis
|
||||
- name: data
|
||||
mountPath: /data
|
||||
args: ["redis-server", "/etc/redis/redis.conf"]
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- redis-cli
|
||||
- ping
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- redis-cli
|
||||
- ping
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop: ["ALL"]
|
||||
# Sentinel sidecar on master
|
||||
- name: sentinel
|
||||
image: "{{ .Values.redis.sentinel.image.repository }}:{{ .Values.redis.sentinel.image.tag }}"
|
||||
ports:
|
||||
- name: sentinel
|
||||
containerPort: {{ .Values.redis.ports.sentinel }}
|
||||
resources:
|
||||
{{- toYaml .Values.redis.sentinel.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: sentinel-config
|
||||
mountPath: /etc/redis-sentinel
|
||||
command: ["/bin/bash", "/etc/redis-scripts/init-sentinel.sh"]
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop: ["ALL"]
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: redis-config
|
||||
- name: sentinel-config
|
||||
configMap:
|
||||
name: redis-sentinel-config
|
||||
- name: scripts
|
||||
configMap:
|
||||
name: redis-scripts
|
||||
defaultMode: 0755
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.redis.master.storage.size }}
|
||||
storageClassName: {{ .Values.redis.master.storage.storageClass }}
|
||||
---
|
||||
# Redis Replicas
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: redis-replica
|
||||
namespace: {{ .Values.namespace }}
|
||||
labels:
|
||||
{{- include "osint-dashboard.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: redis
|
||||
redis-role: replica
|
||||
spec:
|
||||
serviceName: redis-replica
|
||||
replicas: {{ .Values.redis.replica.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "osint-dashboard.selectorLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: redis
|
||||
redis-role: replica
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "osint-dashboard.selectorLabels" . | nindent 8 }}
|
||||
app.kubernetes.io/component: redis
|
||||
redis-role: replica
|
||||
annotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "9121"
|
||||
spec:
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 999
|
||||
fsGroup: 999
|
||||
containers:
|
||||
- name: redis
|
||||
image: "{{ .Values.redis.image.repository }}:{{ .Values.redis.image.tag }}"
|
||||
ports:
|
||||
- name: redis
|
||||
containerPort: {{ .Values.redis.ports.redis }}
|
||||
resources:
|
||||
{{- toYaml .Values.redis.replica.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: /etc/redis
|
||||
- name: data
|
||||
mountPath: /data
|
||||
env:
|
||||
- name: REDIS_ROLE
|
||||
value: "replica"
|
||||
command: ["/bin/bash", "/etc/redis-scripts/redis.sh"]
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- redis-cli
|
||||
- ping
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- redis-cli
|
||||
- ping
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 10
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop: ["ALL"]
|
||||
# Sentinel sidecar on replicas
|
||||
- name: sentinel
|
||||
image: "{{ .Values.redis.sentinel.image.repository }}:{{ .Values.redis.sentinel.image.tag }}"
|
||||
ports:
|
||||
- name: sentinel
|
||||
containerPort: {{ .Values.redis.ports.sentinel }}
|
||||
resources:
|
||||
{{- toYaml .Values.redis.sentinel.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: sentinel-config
|
||||
mountPath: /etc/redis-sentinel
|
||||
command: ["/bin/bash", "/etc/redis-scripts/init-sentinel.sh"]
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop: ["ALL"]
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: redis-config
|
||||
- name: sentinel-config
|
||||
configMap:
|
||||
name: redis-sentinel-config
|
||||
- name: scripts
|
||||
configMap:
|
||||
name: redis-scripts
|
||||
defaultMode: 0755
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.redis.replica.storage.size }}
|
||||
storageClassName: {{ .Values.redis.replica.storage.storageClass }}
|
||||
{{- end }}
|
||||
Loading…
Reference in a new issue