This commit is contained in:
2026-10-18 14:50:07 -04:00
parent cb4aad1006
commit ece4ef223c
16 changed files with 658 additions and 94 deletions
+103
View File
@@ -0,0 +1,103 @@
# SPDX-License-Identifier: MIT-0
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ the_button_name | to_json }}
namespace: {{ the_button_namespace | to_json }}
labels:
app.kubernetes.io/name: the-button
app.kubernetes.io/instance: {{ the_button_name | to_json }}
app.kubernetes.io/managed-by: ansible
spec:
# State is cached in-process and persisted to files; never run concurrent replicas.
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app.kubernetes.io/name: the-button
app.kubernetes.io/instance: {{ the_button_name | to_json }}
template:
metadata:
labels:
app.kubernetes.io/name: the-button
app.kubernetes.io/instance: {{ the_button_name | to_json }}
spec:
automountServiceAccountToken: false
securityContext:
runAsNonRoot: true
runAsUser: 10001
runAsGroup: 10001
fsGroup: 10001
fsGroupChangePolicy: OnRootMismatch
seccompProfile:
type: RuntimeDefault
terminationGracePeriodSeconds: 30
{% if the_button_image_pull_secrets | length > 0 %}
imagePullSecrets:
{% for secret in the_button_image_pull_secrets %}
- name: {{ secret | to_json }}
{% endfor %}
{% endif %}
nodeSelector: {{ the_button_node_selector | to_json }}
tolerations: {{ the_button_tolerations | to_json }}
affinity: {{ the_button_affinity | to_json }}
containers:
- name: the-button
image: {{ the_button_image | to_json }}
imagePullPolicy: {{ the_button_image_pull_policy | to_json }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: [ALL]
ports:
- name: http
containerPort: 8000
protocol: TCP
env:
- name: BUTTON_HOST
value: "0.0.0.0"
- name: BUTTON_PORT
value: "8000"
- name: BUTTON_DURATION_SECONDS
value: {{ (the_button_duration_seconds | string) | to_json }}
- name: BUTTON_DATA_FILE
value: /data/data.json
- name: BUTTON_MAILING_LIST_FILE
value: /data/mailing_list.csv
- name: PYTHONDONTWRITEBYTECODE
value: "1"
resources: {{ the_button_resources | to_json }}
startupProbe:
httpGet:
path: /api/state
port: http
periodSeconds: 5
timeoutSeconds: 5
failureThreshold: 30
readinessProbe:
httpGet:
path: /api/state
port: http
periodSeconds: 10
timeoutSeconds: 5
livenessProbe:
httpGet:
path: /api/state
port: http
periodSeconds: 20
timeoutSeconds: 5
failureThreshold: 3
volumeMounts:
- name: data
mountPath: /data
- name: tmp
mountPath: /tmp
volumes:
- name: data
persistentVolumeClaim:
claimName: {{ (the_button_existing_claim or (the_button_name ~ '-data')) | to_json }}
- name: tmp
emptyDir:
sizeLimit: 64Mi
+37
View File
@@ -0,0 +1,37 @@
# SPDX-License-Identifier: MIT-0
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ the_button_name | to_json }}
namespace: {{ the_button_namespace | to_json }}
labels:
app.kubernetes.io/name: the-button
app.kubernetes.io/instance: {{ the_button_name | to_json }}
app.kubernetes.io/managed-by: ansible
{% if the_button_ingress_annotations %}
annotations:
{% for key, value in the_button_ingress_annotations.items() %}
{{ key | to_json }}: {{ (value | string) | to_json }}
{% endfor %}
{% else %}
annotations: {}
{% endif %}
spec:
{% if the_button_ingress_class_name | length > 0 %}
ingressClassName: {{ the_button_ingress_class_name | to_json }}
{% endif %}
tls:
- hosts:
- {{ the_button_ingress_host | to_json }}
secretName: {{ the_button_tls_secret_name | to_json }}
rules:
- host: {{ the_button_ingress_host | to_json }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ the_button_name | to_json }}
port:
name: http
+18
View File
@@ -0,0 +1,18 @@
# SPDX-License-Identifier: MIT-0
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ (the_button_name ~ '-data') | to_json }}
namespace: {{ the_button_namespace | to_json }}
labels:
app.kubernetes.io/name: the-button
app.kubernetes.io/instance: {{ the_button_name | to_json }}
app.kubernetes.io/managed-by: ansible
spec:
accessModes: {{ the_button_storage_access_modes | to_json }}
{% if the_button_storage_class is not none %}
storageClassName: {{ the_button_storage_class | to_json }}
{% endif %}
resources:
requests:
storage: {{ the_button_storage_size | to_json }}
+20
View File
@@ -0,0 +1,20 @@
# SPDX-License-Identifier: MIT-0
apiVersion: v1
kind: Service
metadata:
name: {{ the_button_name | to_json }}
namespace: {{ the_button_namespace | to_json }}
labels:
app.kubernetes.io/name: the-button
app.kubernetes.io/instance: {{ the_button_name | to_json }}
app.kubernetes.io/managed-by: ansible
spec:
type: ClusterIP
selector:
app.kubernetes.io/name: the-button
app.kubernetes.io/instance: {{ the_button_name | to_json }}
ports:
- name: http
port: 80
targetPort: http
protocol: TCP