wip: contenido inicial + test de reusable workflow / composite action

This commit is contained in:
devops committed 2026-08-17 00:12:10 -05:00
1 parent e9fe7d0567
commit 262c0f271a
22 files changed
+1480

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: app-deployment
labels:
app: app
spec:
replicas: 1
selector:
matchLabels:
app: app
template:
metadata:
labels:
app: app
spec:
imagePullSecrets:
- name: gitea-registry-secret
# Nivel Pod: nada corre como root a menos que el overlay lo
# sobreescriba explícitamente (y debería justificarlo si lo hace).
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- name: app
# CAMBIAR: imagen real de tu app. El overlay la sobreescribe.
image: gitea.cruzcloud.net/devops/CAMBIAR-imagen:v0.0.0
ports:
- name: http
containerPort: 8080
# Nivel contenedor: complementa el runAsNonRoot de arriba.
# readOnlyRootFilesystem queda en false por default porque
# muchos runtimes (Next.js standalone, cachés de npm/pip)
# escriben en disco al arrancar -- si tu app NO escribe nada
# en runtime, ponelo en true y listo (más seguro).
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: false
capabilities:
drop:
- ALL
# CAMBIAR: casi seguro tu app expone un endpoint de salud
# distinto a "/" (ver README de tu arquetipo de pipeline —
# los 3 arquetipos ya documentan cuál usa cada stack).
readinessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 6
livenessProbe:
httpGet:
path: /
port: http
initialDelaySeconds: 15
periodSeconds: 20
timeoutSeconds: 5
failureThreshold: 6
# Límites conservadores para una app chica/media. Subilos en
# tu overlay si tu app realmente los necesita — pero no los
# borres: sin esto, un solo pod con un bug de memoria puede
# arrastrar al nodo entero a swap (visto en vivo con
# gitea-runner sin límites, ver docs-portal del lab).
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
cpu: 500m
memory: 512Mi
+23
View File
@@ -0,0 +1,23 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app-ingress
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: web
spec:
ingressClassName: traefik
rules:
# CAMBIAR: el host público real. Sigue el patrón *.cruzcloud.net
# ya usado por shop/commerce/docs — apunta a NPM -> serverlb ->
# Traefik -> este Service (ver reference_infra_topology en la
# memoria del lab si necesitás repasar la ruta completa).
- host: CAMBIAR-app.cruzcloud.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: app-svc
port:
number: 80
+7
View File
@@ -0,0 +1,7 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- deployment.yaml
- service.yaml
- ingress.yaml
+11
View File
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: app-svc
spec:
selector:
app: app
ports:
- name: http
port: 80
targetPort: http
@@ -0,0 +1,57 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: mi-app-ejemplo
resources:
- ../../base
patches:
# Contenido real de tu app (imagen, puerto, probes, etc.) — el
# "name" del contenedor se queda en "app" a propósito, ver el
# comentario en patches/deployment.yaml.
- target:
kind: Deployment
name: app-deployment
path: patches/deployment.yaml
- target:
kind: Service
name: app-svc
path: patches/service.yaml
- target:
kind: Ingress
name: app-ingress
path: patches/ingress.yaml
# Renombrar los objetos en sí (Kustomize no lo hace con un patch de
# merge normal -- cambiar metadata.name ahí simplemente no aplica.
# Hace falta un patch JSON6902 explícito, uno por recurso).
- target:
kind: Deployment
name: app-deployment
patch: |-
- op: replace
path: /metadata/name
value: mi-app-ejemplo-deployment
# El puerto real de la app: reemplazo la lista de "ports" entera
# por JSON6902 -- un patch de merge normal (ver patches/deployment.yaml)
# NO reemplaza esta lista, la duplica (confirmado en vivo).
- op: replace
path: /spec/template/spec/containers/0/ports
value:
- name: http
containerPort: 3000
- target:
kind: Service
name: app-svc
patch: |-
- op: replace
path: /metadata/name
value: mi-app-ejemplo-svc
- target:
kind: Ingress
name: app-ingress
patch: |-
- op: replace
path: /metadata/name
value: mi-app-ejemplo-ingress
@@ -0,0 +1,37 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: app-deployment
labels:
app: mi-app-ejemplo
spec:
replicas: 1
selector:
matchLabels:
app: mi-app-ejemplo
template:
metadata:
labels:
app: mi-app-ejemplo
spec:
containers:
# OJO: el "name" del contenedor se queda en "app", igual que en
# el base -- es la clave que usa Kustomize para fusionar este
# patch con el contenedor del base en vez de agregar uno
# nuevo al lado. No lo cambies.
- name: app
image: gitea.cruzcloud.net/devops/mi-app-ejemplo:v1.0.1
# El puerto real NO se cambia acá -- $patch: replace no
# funciona para esto en esta versión de Kustomize (probado en
# vivo, se probó y se descartó). Se reemplaza con un patch
# JSON6902 aparte, ver kustomization.yaml. Si no tocás el
# puerto (8080 te sirve tal cual), podés borrar este comentario
# y el patch JSON6902 correspondiente, y listo.
readinessProbe:
httpGet:
path: /api/health
port: http
livenessProbe:
httpGet:
path: /api/health
port: http
@@ -0,0 +1,16 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app-ingress
spec:
rules:
- host: mi-app-ejemplo.cruzcloud.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: mi-app-ejemplo-svc
port:
number: 80
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: app-svc
spec:
selector:
app: mi-app-ejemplo
ports:
- name: http
port: 80
targetPort: 3000