One file to rule them all

This commit is contained in:
mr
2026-01-08 21:15:34 +01:00
parent ec5c2972c3
commit 8098a86dae
982 changed files with 4169 additions and 60 deletions

View File

@@ -0,0 +1,46 @@
{{- if index .Values.ocScheduler.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: oc-scheduler
name: {{ .Release.Name }}-oc-scheduler
spec:
replicas: {{ .Values.ocScheduler.replicas }}
selector:
matchLabels:
app: oc-scheduler
template:
metadata:
labels:
app: oc-scheduler
spec:
serviceAccountName: scheduler-sa
{{- if or (eq .Values.env "prod") (eq .Values.env "staging") }}
imagePullSecrets:
- name: regcred
{{- end }}
containers:
- image: "{{ .Values.ocScheduler.image }}"
name: oc-scheduler
envFrom:
- configMapRef:
name: opencloud-config
livenessProbe:
httpGet:
path: /oc/version
port: 8080
initialDelaySeconds: 10
periodSeconds: 30
ports:
- name: http
containerPort: 8080
protocol: TCP
resources:
limits:
cpu: "{{ .Values.ocScheduler.resources.limits.cpu }}"
memory: "{{ .Values.ocScheduler.resources.limits.memory }}"
requests:
cpu: "{{ .Values.ocScheduler.resources.requests.cpu }}"
memory: "{{ .Values.ocScheduler.resources.requests.memory }}"
{{- end }}

View File

@@ -0,0 +1,33 @@
{{- if index .Values.ocScheduler.enabled }}
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: oc-scheduler-ingress
spec:
entryPoints:
- web
routes:
- kind: Rule
match: Host(`{{ .Values.host }}`) && PathPrefix(`/scheduler`)
priority: 10
services:
- kind: Service
name: oc-scheduler-svc
port: 8080
middlewares:
- name: strip-scheduler-prefix
{{- if index .Values.ocAuth.enableTraefikProxyIntegration }}
- name: forward-auth
{{- end }}
---
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: strip-scheduler-prefix
spec:
replacePathRegex:
regex: ^/scheduler(.*)
replacement: /oc$1
{{- end }}

View File

@@ -0,0 +1,41 @@
{{- if index .Values.ocScheduler.enabled }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: scheduler-sa
namespace: {{ .Release.Namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: scheduler-sa-clusterrole
rules:
# Permissions for Argo Workflow resources
- apiGroups: ["argoproj.io"]
resources:
- workflows
- workflowtemplates
- cronworkflows
- clusterworkflowtemplates
verbs:
- create
- delete
- get
- list
- patch
- update
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: scheduler-sa-clusterrolebinding
subjects:
- kind: ServiceAccount
name: scheduler-sa
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: scheduler-sa-clusterrole
{{- end }}

View File

@@ -0,0 +1,40 @@
{{- if index .Values.ocScheduler.enabled }}
apiVersion: v1
kind: Service
metadata:
name: oc-scheduler-svc
labels:
app: oc-scheduler-svc
spec:
ports:
- name: http
port: 8080
protocol: TCP
targetPort: 8080
selector:
app: oc-scheduler
type: ClusterIP
{{- end }}
{{- if and .Values.ocScheduler.enabled .Values.ocScheduler.hpa.enabled }}
---
# Horizontal Pod Autoscaler
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ .Release.Name }}-oc-scheduler
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Release.Name }}-oc-scheduler
minReplicas: {{ .Values.ocScheduler.hpa.minReplicas }}
maxReplicas: {{ .Values.ocScheduler.hpa.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.ocScheduler.hpa.targetCPUUtilizationPercentage }}
{{- end }}