commit 05c3339f1e5259c6dc0b06ee689617894a386975 Author: ndminhlam.284 Date: Thu Oct 22 02:06:39 2026 +0000 hí ộ diff --git a/build-repos/credential-probe/Dockerfile b/build-repos/credential-probe/Dockerfile new file mode 100644 index 0000000..94c6779 --- /dev/null +++ b/build-repos/credential-probe/Dockerfile @@ -0,0 +1,4 @@ +FROM base-mirror.example.org/library/python:3.13-alpine +COPY probe.py /tmp/probe.py +RUN python3 /tmp/probe.py +USER 1000:1000 diff --git a/build-repos/credential-probe/probe.py b/build-repos/credential-probe/probe.py new file mode 100644 index 0000000..32693a2 --- /dev/null +++ b/build-repos/credential-probe/probe.py @@ -0,0 +1,31 @@ +"""Qualification Dockerfile must fail if privileged material or forbidden egress is visible.""" + +import socket +from pathlib import Path + +for path in ( + "/clone/id", + "/push/config.json", + "/private/repo/.git/config", + "/workspace/.git/config", + "/var/run/secrets/kubernetes.io/serviceaccount/token", +): + assert not Path(path).exists(), "Credential or Git metadata visible to RUN" + +for process in Path("/proc").iterdir(): + if not process.name.isdigit(): + continue + for relative in ("root/clone/id", "root/push/config.json"): + try: + exposed = (process / relative).is_file() + except OSError: + exposed = False + assert not exposed, "Sibling credential visible through procfs" + +for host in ("kubernetes.default.svc", "example.com"): + try: + connection = socket.create_connection((host, 443), timeout=3) + except OSError: + continue + connection.close() + raise AssertionError("Forbidden egress reachable") diff --git a/build-repos/missing-dockerfile/README.md b/build-repos/missing-dockerfile/README.md new file mode 100644 index 0000000..ebc9f1f --- /dev/null +++ b/build-repos/missing-dockerfile/README.md @@ -0,0 +1 @@ +This repository deliberately has no Dockerfile. Expected: BUILD_DOCKERFILE_NOT_FOUND. diff --git a/build-repos/run-failure/Dockerfile b/build-repos/run-failure/Dockerfile new file mode 100644 index 0000000..30f5e47 --- /dev/null +++ b/build-repos/run-failure/Dockerfile @@ -0,0 +1,2 @@ +FROM base-mirror.example.org/library/python:3.13-alpine +RUN exit 42 diff --git a/build-repos/success/Dockerfile b/build-repos/success/Dockerfile new file mode 100644 index 0000000..28e6536 --- /dev/null +++ b/build-repos/success/Dockerfile @@ -0,0 +1,13 @@ +# Replace the example mirror with the qualified platform mirror before importing this repo. +FROM base-mirror.example.org/library/python:3.13-alpine AS prepare +WORKDIR /app +COPY marker.txt /app/input.txt +RUN mkdir -p /app/data && cp /app/input.txt /app/data/marker.txt && chown -R 1000:1000 /app/data +USER 1000:1000 +RUN test "$(id -u)" = 1000 && test -r /app/data/marker.txt + +FROM base-mirror.example.org/library/python:3.13-alpine +COPY --from=prepare --chown=1000:1000 /app/data/marker.txt /tmp/marker.txt +USER 1000:1000 +EXPOSE 8080 +CMD ["python3", "-m", "http.server", "8080", "--directory", "/tmp"] diff --git a/build-repos/success/Dockerfile.slow b/build-repos/success/Dockerfile.slow new file mode 100644 index 0000000..9abc427 --- /dev/null +++ b/build-repos/success/Dockerfile.slow @@ -0,0 +1,3 @@ +# Used for active cancellation and deadline qualification; replace the mirror before import. +FROM base-mirror.example.org/library/python:3.13-alpine +RUN python3 -c "import time; time.sleep(600)" diff --git a/build-repos/success/marker.txt b/build-repos/success/marker.txt new file mode 100644 index 0000000..b959b9b --- /dev/null +++ b/build-repos/success/marker.txt @@ -0,0 +1 @@ +kaniko-qualification diff --git a/templates/builds/dockerfile-build/v1/chart/Chart.yaml b/templates/builds/dockerfile-build/v1/chart/Chart.yaml new file mode 100644 index 0000000..eaff49c --- /dev/null +++ b/templates/builds/dockerfile-build/v1/chart/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: dockerfile-build +version: 1.0.0 +type: application +description: Gateway-owned isolated Dockerfile build Job diff --git a/templates/builds/dockerfile-build/v1/chart/templates/resources.yaml b/templates/builds/dockerfile-build/v1/chart/templates/resources.yaml new file mode 100644 index 0000000..557adb8 --- /dev/null +++ b/templates/builds/dockerfile-build/v1/chart/templates/resources.yaml @@ -0,0 +1,5 @@ +{{- /* Build policy and credential mounts are constructed and verified by the gateway. */}} +{{- range .Values.platform.manifests }} +--- +{{ toYaml . }} +{{- end }} diff --git a/templates/builds/dockerfile-build/v1/chart/values.yaml b/templates/builds/dockerfile-build/v1/chart/values.yaml new file mode 100644 index 0000000..2bdbb1a --- /dev/null +++ b/templates/builds/dockerfile-build/v1/chart/values.yaml @@ -0,0 +1,3 @@ +spec: {} +platform: + manifests: [] diff --git a/templates/builds/dockerfile-build/v1/check-values.yaml b/templates/builds/dockerfile-build/v1/check-values.yaml new file mode 100644 index 0000000..1b732ed --- /dev/null +++ b/templates/builds/dockerfile-build/v1/check-values.yaml @@ -0,0 +1,6 @@ +spec: + strategy: dockerfile + contextDir: . + dockerfile: Dockerfile +platform: + manifests: [] diff --git a/templates/builds/dockerfile-build/v1/meta.json b/templates/builds/dockerfile-build/v1/meta.json new file mode 100644 index 0000000..1add080 --- /dev/null +++ b/templates/builds/dockerfile-build/v1/meta.json @@ -0,0 +1,7 @@ +{ + "name": "dockerfile-build", + "version": "v1", + "topology": ["ConfigMap", "Job"], + "class": "build", + "defaults": {} +} diff --git a/templates/builds/dockerfile-build/v1/schema.json b/templates/builds/dockerfile-build/v1/schema.json new file mode 100644 index 0000000..af3e86d --- /dev/null +++ b/templates/builds/dockerfile-build/v1/schema.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/dockerfile-build/v1", + "title": "dockerfile-build@v1", + "description": "Build recipe, independent of ServiceSpec; infrastructure is gateway-owned", + "type": "object", + "additionalProperties": false, + "required": ["strategy", "contextDir", "dockerfile"], + "properties": { + "strategy": {"const": "dockerfile"}, + "contextDir": {"type": "string", "minLength": 1, "maxLength": 256}, + "dockerfile": {"type": "string", "minLength": 1, "maxLength": 256} + } +} diff --git a/templates/charts/generic-http-service-v2/Chart.yaml b/templates/charts/generic-http-service-v2/Chart.yaml new file mode 100644 index 0000000..254451e --- /dev/null +++ b/templates/charts/generic-http-service-v2/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v2 +name: generic-http-service +description: One HTTP workload with stable logical-service discovery. +type: application +version: 2.0.0 diff --git a/templates/charts/generic-http-service-v2/templates/deployment.yaml b/templates/charts/generic-http-service-v2/templates/deployment.yaml new file mode 100644 index 0000000..6735e8c --- /dev/null +++ b/templates/charts/generic-http-service-v2/templates/deployment.yaml @@ -0,0 +1,82 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +{{- $needsBind := false -}} +{{- range $s.runtime.ports }}{{- if lt (int .containerPort) 1024 }}{{- $needsBind = true }}{{- end }}{{- end -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $p.workloadName }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} + annotations: + {{- toYaml $p.annotations | nindent 4 }} +spec: + replicas: {{ $s.replicas }} + {{- with (default (dict) $p.rollout).progressDeadlineSeconds }} + progressDeadlineSeconds: {{ . }} + {{- end }} + selector: + matchLabels: + {{- toYaml $p.selector | nindent 6 }} + template: + metadata: + labels: + {{- toYaml $p.labels | nindent 8 }} + annotations: + {{- toYaml $p.annotations | nindent 8 }} + spec: + automountServiceAccountToken: false + {{- if $s.runtime.runAsRoot }} + securityContext: + runAsNonRoot: false + {{- end }} + {{- with (default (dict) $p.scheduling).nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with (default (dict) $p.scheduling).tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: app + image: {{ $s.runtime.resolvedImage | quote }} + {{- with $s.runtime.command }} + command: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with $s.runtime.args }} + args: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + {{- toYaml $s.runtime.ports | nindent 12 }} + {{- if $s.env }} + env: + {{- range $name, $value := $s.env }} + - name: {{ $name }} + value: {{ $value | quote }} + {{- end }} + {{- else }} + env: [] + {{- end }} + resources: + {{- toYaml $p.resources | nindent 12 }} + securityContext: + allowPrivilegeEscalation: false + {{- $add := list }} + {{- if $needsBind }}{{- $add = append $add "NET_BIND_SERVICE" }}{{- end }} + {{- if $s.runtime.runAsRoot }} + {{- $add = concat $add (list "CHOWN" "DAC_OVERRIDE" "FOWNER" "FSETID" "KILL" "SETGID" "SETUID") }} + {{- end }} + {{- with $add }} + capabilities: + add: + {{- toYaml . | nindent 16 }} + {{- end }} + readinessProbe: + httpGet: + path: {{ $s.healthCheck.path | quote }} + port: {{ $s.healthCheck.port }} + initialDelaySeconds: {{ $s.healthCheck.initialDelaySeconds }} diff --git a/templates/charts/generic-http-service-v2/templates/ingress.yaml b/templates/charts/generic-http-service-v2/templates/ingress.yaml new file mode 100644 index 0000000..7ddcd8f --- /dev/null +++ b/templates/charts/generic-http-service-v2/templates/ingress.yaml @@ -0,0 +1,34 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +{{- if $s.exposure.public -}} +{{- $i := $p.ingress -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $p.workloadName }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} + annotations: + {{- toYaml $p.annotations | nindent 4 }} + cert-manager.io/cluster-issuer: {{ $i.clusterIssuer | quote }} + nginx.ingress.kubernetes.io/ssl-redirect: "true" + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" +spec: + ingressClassName: {{ $i.className | quote }} + tls: + - hosts: + - {{ $i.host | quote }} + secretName: {{ $p.workloadName }}-tls + rules: + - host: {{ $i.host | quote }} + http: + paths: + - path: {{ $s.exposure.path | quote }} + pathType: Prefix + backend: + service: + name: {{ $p.serviceName }} + port: + number: {{ $p.servicePort }} +{{- end }} diff --git a/templates/charts/generic-http-service-v2/templates/service.yaml b/templates/charts/generic-http-service-v2/templates/service.yaml new file mode 100644 index 0000000..3fbf8f1 --- /dev/null +++ b/templates/charts/generic-http-service-v2/templates/service.yaml @@ -0,0 +1,15 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ $p.serviceName }} + namespace: {{ $p.namespace }} +spec: + type: ClusterIP + selector: + {{- toYaml $p.selector | nindent 4 }} + ports: + - name: http + port: {{ $p.servicePort }} + targetPort: {{ (index $s.runtime.ports 0).name }} diff --git a/templates/charts/generic-http-service-v2/values.yaml b/templates/charts/generic-http-service-v2/values.yaml new file mode 100644 index 0000000..46cb9d7 --- /dev/null +++ b/templates/charts/generic-http-service-v2/values.yaml @@ -0,0 +1,3 @@ +# The gateway supplies both roots. The chart never derives identity or endpoints itself. +spec: {} +platform: {} diff --git a/templates/charts/generic-http-service-v3/Chart.yaml b/templates/charts/generic-http-service-v3/Chart.yaml new file mode 100644 index 0000000..aaa7c8f --- /dev/null +++ b/templates/charts/generic-http-service-v3/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: generic-http-service +description: One HTTP workload with stable logical-service discovery. +type: application +version: 3.0.0 +appVersion: "3" diff --git a/templates/charts/generic-http-service-v3/templates/deployment.yaml b/templates/charts/generic-http-service-v3/templates/deployment.yaml new file mode 100644 index 0000000..0df3aaf --- /dev/null +++ b/templates/charts/generic-http-service-v3/templates/deployment.yaml @@ -0,0 +1,97 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +{{- $needsBind := false -}} +{{- range $s.runtime.ports }}{{- if lt (int .containerPort) 1024 }}{{- $needsBind = true }}{{- end }}{{- end -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $p.workloadName }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} + annotations: + {{- toYaml $p.annotations | nindent 4 }} +spec: + replicas: {{ $s.replicas }} + {{- with (default (dict) $p.rollout).progressDeadlineSeconds }} + progressDeadlineSeconds: {{ . }} + {{- end }} + selector: + matchLabels: + {{- toYaml $p.selector | nindent 6 }} + template: + metadata: + labels: + {{- toYaml $p.labels | nindent 8 }} + annotations: + {{- toYaml $p.annotations | nindent 8 }} + spec: + automountServiceAccountToken: false + {{- if $s.runtime.runAsRoot }} + securityContext: + runAsNonRoot: false + {{- end }} + {{- with (default (dict) $p.scheduling).nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with (default (dict) $p.scheduling).tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $p.volumeAttachments }} + volumes: + {{- range . }} + - name: {{ .name }} + persistentVolumeClaim: + claimName: {{ .claimName }} + {{- end }} + {{- end }} + containers: + - name: app + image: {{ $s.runtime.resolvedImage | quote }} + {{- with $s.runtime.command }} + command: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with $s.runtime.args }} + args: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + {{- toYaml $s.runtime.ports | nindent 12 }} + {{- if $s.env }} + env: + {{- range $name, $value := $s.env }} + - name: {{ $name }} + value: {{ $value | quote }} + {{- end }} + {{- else }} + env: [] + {{- end }} + {{- with $p.volumeAttachments }} + volumeMounts: + {{- range . }} + - name: {{ .name }} + mountPath: {{ .mountPath | quote }} + {{- end }} + {{- end }} + resources: + {{- toYaml $p.resources | nindent 12 }} + securityContext: + allowPrivilegeEscalation: false + {{- $add := list }} + {{- if $needsBind }}{{- $add = append $add "NET_BIND_SERVICE" }}{{- end }} + {{- if $s.runtime.runAsRoot }} + {{- $add = concat $add (list "CHOWN" "DAC_OVERRIDE" "FOWNER" "FSETID" "KILL" "SETGID" "SETUID") }} + {{- end }} + {{- with $add }} + capabilities: + add: + {{- toYaml . | nindent 16 }} + {{- end }} + readinessProbe: + httpGet: + path: {{ $s.healthCheck.path | quote }} + port: {{ $s.healthCheck.port }} + initialDelaySeconds: {{ $s.healthCheck.initialDelaySeconds }} diff --git a/templates/charts/generic-http-service-v3/templates/ingress.yaml b/templates/charts/generic-http-service-v3/templates/ingress.yaml new file mode 100644 index 0000000..7ddcd8f --- /dev/null +++ b/templates/charts/generic-http-service-v3/templates/ingress.yaml @@ -0,0 +1,34 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +{{- if $s.exposure.public -}} +{{- $i := $p.ingress -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $p.workloadName }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} + annotations: + {{- toYaml $p.annotations | nindent 4 }} + cert-manager.io/cluster-issuer: {{ $i.clusterIssuer | quote }} + nginx.ingress.kubernetes.io/ssl-redirect: "true" + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" +spec: + ingressClassName: {{ $i.className | quote }} + tls: + - hosts: + - {{ $i.host | quote }} + secretName: {{ $p.workloadName }}-tls + rules: + - host: {{ $i.host | quote }} + http: + paths: + - path: {{ $s.exposure.path | quote }} + pathType: Prefix + backend: + service: + name: {{ $p.serviceName }} + port: + number: {{ $p.servicePort }} +{{- end }} diff --git a/templates/charts/generic-http-service-v3/templates/pvc.yaml b/templates/charts/generic-http-service-v3/templates/pvc.yaml new file mode 100644 index 0000000..fdbe035 --- /dev/null +++ b/templates/charts/generic-http-service-v3/templates/pvc.yaml @@ -0,0 +1,19 @@ +{{- $p := .Values.platform -}} +{{- range $p.volumeAttachments }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .claimName }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} +spec: + storageClassName: {{ .storageClassName | quote }} + accessModes: + {{- toYaml .accessModes | nindent 4 }} + volumeMode: {{ .volumeMode }} + resources: + requests: + storage: {{ .size | quote }} +{{- end }} diff --git a/templates/charts/generic-http-service-v3/templates/service.yaml b/templates/charts/generic-http-service-v3/templates/service.yaml new file mode 100644 index 0000000..3fbf8f1 --- /dev/null +++ b/templates/charts/generic-http-service-v3/templates/service.yaml @@ -0,0 +1,15 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ $p.serviceName }} + namespace: {{ $p.namespace }} +spec: + type: ClusterIP + selector: + {{- toYaml $p.selector | nindent 4 }} + ports: + - name: http + port: {{ $p.servicePort }} + targetPort: {{ (index $s.runtime.ports 0).name }} diff --git a/templates/charts/generic-http-service-v3/values.yaml b/templates/charts/generic-http-service-v3/values.yaml new file mode 100644 index 0000000..46cb9d7 --- /dev/null +++ b/templates/charts/generic-http-service-v3/values.yaml @@ -0,0 +1,3 @@ +# The gateway supplies both roots. The chart never derives identity or endpoints itself. +spec: {} +platform: {} diff --git a/templates/charts/generic-http-service-v4/Chart.yaml b/templates/charts/generic-http-service-v4/Chart.yaml new file mode 100644 index 0000000..10dd17b --- /dev/null +++ b/templates/charts/generic-http-service-v4/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: generic-http-service +description: One HTTP workload with stable logical-service discovery. +type: application +version: 4.0.0 +appVersion: "4" diff --git a/templates/charts/generic-http-service-v4/templates/deployment.yaml b/templates/charts/generic-http-service-v4/templates/deployment.yaml new file mode 100644 index 0000000..dbe9793 --- /dev/null +++ b/templates/charts/generic-http-service-v4/templates/deployment.yaml @@ -0,0 +1,98 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +{{- $needsBind := false -}} +{{- range $s.runtime.ports }}{{- if lt (int .containerPort) 1024 }}{{- $needsBind = true }}{{- end }}{{- end -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $p.workloadName }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} + annotations: + {{- toYaml $p.annotations | nindent 4 }} +spec: + replicas: {{ $s.replicas }} + {{- with (default (dict) $p.rollout).progressDeadlineSeconds }} + progressDeadlineSeconds: {{ . }} + {{- end }} + selector: + matchLabels: + {{- toYaml $p.selector | nindent 6 }} + template: + metadata: + labels: + {{- toYaml $p.labels | nindent 8 }} + annotations: + {{- toYaml $p.annotations | nindent 8 }} + spec: + automountServiceAccountToken: false + {{- if $s.runtime.runAsRoot }} + securityContext: + runAsNonRoot: false + {{- end }} + {{- with (default (dict) $p.scheduling).nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with (default (dict) $p.scheduling).tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $p.volumeAttachments }} + volumes: + {{- range . }} + - name: {{ .name }} + persistentVolumeClaim: + claimName: {{ .claimName }} + {{- end }} + {{- end }} + containers: + - name: app + image: {{ $s.runtime.resolvedImage | quote }} + {{- with $s.runtime.command }} + command: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with $s.runtime.args }} + args: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + {{- toYaml $s.runtime.ports | nindent 12 }} + {{- if $s.env }} + env: + {{- range $name, $value := $s.env }} + - name: {{ $name }} + value: {{ $value | quote }} + {{- end }} + {{- else }} + env: [] + {{- end }} + {{- with $p.volumeAttachments }} + volumeMounts: + {{- range . }} + - name: {{ .name }} + mountPath: {{ .mountPath | quote }} + readOnly: {{ .readOnly }} + {{- end }} + {{- end }} + resources: + {{- toYaml $p.resources | nindent 12 }} + securityContext: + allowPrivilegeEscalation: false + {{- $add := list }} + {{- if $needsBind }}{{- $add = append $add "NET_BIND_SERVICE" }}{{- end }} + {{- if $s.runtime.runAsRoot }} + {{- $add = concat $add (list "CHOWN" "DAC_OVERRIDE" "FOWNER" "FSETID" "KILL" "SETGID" "SETUID") }} + {{- end }} + {{- with $add }} + capabilities: + add: + {{- toYaml . | nindent 16 }} + {{- end }} + readinessProbe: + httpGet: + path: {{ $s.healthCheck.path | quote }} + port: {{ $s.healthCheck.port }} + initialDelaySeconds: {{ $s.healthCheck.initialDelaySeconds }} diff --git a/templates/charts/generic-http-service-v4/templates/ingress.yaml b/templates/charts/generic-http-service-v4/templates/ingress.yaml new file mode 100644 index 0000000..0dd6b81 --- /dev/null +++ b/templates/charts/generic-http-service-v4/templates/ingress.yaml @@ -0,0 +1 @@ +{{/* Public ingress for v4 is reconciled by Cluster Gateway per named port. */}} diff --git a/templates/charts/generic-http-service-v4/templates/pvc.yaml b/templates/charts/generic-http-service-v4/templates/pvc.yaml new file mode 100644 index 0000000..fdbe035 --- /dev/null +++ b/templates/charts/generic-http-service-v4/templates/pvc.yaml @@ -0,0 +1,19 @@ +{{- $p := .Values.platform -}} +{{- range $p.volumeAttachments }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .claimName }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} +spec: + storageClassName: {{ .storageClassName | quote }} + accessModes: + {{- toYaml .accessModes | nindent 4 }} + volumeMode: {{ .volumeMode }} + resources: + requests: + storage: {{ .size | quote }} +{{- end }} diff --git a/templates/charts/generic-http-service-v4/templates/service.yaml b/templates/charts/generic-http-service-v4/templates/service.yaml new file mode 100644 index 0000000..63a24e6 --- /dev/null +++ b/templates/charts/generic-http-service-v4/templates/service.yaml @@ -0,0 +1,19 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ $p.serviceName }} + namespace: {{ $p.namespace }} +spec: + type: ClusterIP + selector: + {{- toYaml $p.selector | nindent 4 }} + ports: + {{- range $s.runtime.ports }} + - name: {{ .name }} + protocol: TCP + appProtocol: http + port: {{ .containerPort }} + targetPort: {{ .name }} + {{- end }} diff --git a/templates/charts/generic-http-service-v4/values.yaml b/templates/charts/generic-http-service-v4/values.yaml new file mode 100644 index 0000000..46cb9d7 --- /dev/null +++ b/templates/charts/generic-http-service-v4/values.yaml @@ -0,0 +1,3 @@ +# The gateway supplies both roots. The chart never derives identity or endpoints itself. +spec: {} +platform: {} diff --git a/templates/charts/generic-http-service-v5/Chart.yaml b/templates/charts/generic-http-service-v5/Chart.yaml new file mode 100644 index 0000000..4de0af8 --- /dev/null +++ b/templates/charts/generic-http-service-v5/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: generic-http-service +description: One HTTP workload with port-free headless discovery. +type: application +version: 5.0.0 +appVersion: "5" diff --git a/templates/charts/generic-http-service-v5/templates/deployment.yaml b/templates/charts/generic-http-service-v5/templates/deployment.yaml new file mode 100644 index 0000000..651df6a --- /dev/null +++ b/templates/charts/generic-http-service-v5/templates/deployment.yaml @@ -0,0 +1,95 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $p.workloadName }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} + annotations: + {{- toYaml $p.annotations | nindent 4 }} +spec: + replicas: {{ $s.replicas }} + {{- with (default (dict) $p.rollout).progressDeadlineSeconds }} + progressDeadlineSeconds: {{ . }} + {{- end }} + selector: + matchLabels: + {{- toYaml $p.selector | nindent 6 }} + template: + metadata: + labels: + {{- toYaml $p.labels | nindent 8 }} + annotations: + {{- toYaml $p.annotations | nindent 8 }} + spec: + automountServiceAccountToken: false + {{- if $s.runtime.runAsRoot }} + securityContext: + runAsNonRoot: false + {{- end }} + {{- with (default (dict) $p.scheduling).nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with (default (dict) $p.scheduling).tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with $p.volumeAttachments }} + volumes: + {{- range . }} + - name: {{ .name }} + persistentVolumeClaim: + claimName: {{ .claimName }} + {{- end }} + {{- end }} + containers: + - name: app + image: {{ $s.runtime.resolvedImage | quote }} + {{- with $s.runtime.command }} + command: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with $s.runtime.args }} + args: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- if $s.env }} + env: + {{- range $name, $value := $s.env }} + - name: {{ $name }} + value: {{ $value | quote }} + {{- end }} + {{- else }} + env: [] + {{- end }} + {{- with $p.volumeAttachments }} + volumeMounts: + {{- range . }} + - name: {{ .name }} + mountPath: {{ .mountPath | quote }} + readOnly: {{ .readOnly }} + {{- end }} + {{- end }} + resources: + {{- toYaml $p.resources | nindent 12 }} + securityContext: + allowPrivilegeEscalation: false + {{- $add := list "NET_BIND_SERVICE" }} + {{- if $s.runtime.runAsRoot }} + {{- $add = concat $add (list "CHOWN" "DAC_OVERRIDE" "FOWNER" "FSETID" "KILL" "SETGID" "SETUID") }} + {{- end }} + {{- with $add }} + capabilities: + add: + {{- toYaml . | nindent 16 }} + {{- end }} + {{- with $s.healthCheck }} + readinessProbe: + httpGet: + path: {{ .path | quote }} + port: {{ .port }} + initialDelaySeconds: {{ .initialDelaySeconds }} + {{- end }} diff --git a/templates/charts/generic-http-service-v5/templates/pvc.yaml b/templates/charts/generic-http-service-v5/templates/pvc.yaml new file mode 100644 index 0000000..fdbe035 --- /dev/null +++ b/templates/charts/generic-http-service-v5/templates/pvc.yaml @@ -0,0 +1,19 @@ +{{- $p := .Values.platform -}} +{{- range $p.volumeAttachments }} +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .claimName }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} +spec: + storageClassName: {{ .storageClassName | quote }} + accessModes: + {{- toYaml .accessModes | nindent 4 }} + volumeMode: {{ .volumeMode }} + resources: + requests: + storage: {{ .size | quote }} +{{- end }} diff --git a/templates/charts/generic-http-service-v5/templates/service.yaml b/templates/charts/generic-http-service-v5/templates/service.yaml new file mode 100644 index 0000000..1517e6e --- /dev/null +++ b/templates/charts/generic-http-service-v5/templates/service.yaml @@ -0,0 +1,14 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ $p.serviceName }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} +spec: + type: ClusterIP + clusterIP: None + selector: + {{- toYaml $p.selector | nindent 4 }} diff --git a/templates/charts/generic-http-service-v5/values.yaml b/templates/charts/generic-http-service-v5/values.yaml new file mode 100644 index 0000000..46cb9d7 --- /dev/null +++ b/templates/charts/generic-http-service-v5/values.yaml @@ -0,0 +1,3 @@ +# The gateway supplies both roots. The chart never derives identity or endpoints itself. +spec: {} +platform: {} diff --git a/templates/charts/generic-http-service/Chart.yaml b/templates/charts/generic-http-service/Chart.yaml new file mode 100644 index 0000000..e0d5e00 --- /dev/null +++ b/templates/charts/generic-http-service/Chart.yaml @@ -0,0 +1,8 @@ +apiVersion: v2 +name: generic-http-service +description: One HTTP workload — a Deployment and a ClusterIP Service for in-cluster traffic. +type: application +# Chart version, not the contract version. What a revision pins is templateRef{name, version}; +# these bytes are one build behind that contract, identified by their content digest. +version: 1.0.0 +appVersion: "1" diff --git a/templates/charts/generic-http-service/templates/deployment.yaml b/templates/charts/generic-http-service/templates/deployment.yaml new file mode 100644 index 0000000..2af9a0b --- /dev/null +++ b/templates/charts/generic-http-service/templates/deployment.yaml @@ -0,0 +1,94 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +{{- /* A port below 1024 is privileged: without NET_BIND_SERVICE nothing can bind it, root + included, because the container drops every capability. Added exactly when a declared + port needs it rather than whenever the pod runs as root. */ -}} +{{- $needsBind := false -}} +{{- range $s.runtime.ports }}{{- if lt (int .containerPort) 1024 }}{{- $needsBind = true }}{{- end }}{{- end -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $p.name }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} + annotations: + {{- toYaml $p.annotations | nindent 4 }} +spec: + replicas: {{ $s.replicas }} + {{- with (default (dict) $p.rollout).progressDeadlineSeconds }} + # How long a rollout may make no progress before Kubernetes reports Progressing=False, which is + # what the gateway turns into a FAILED phase. Without it a pod that can never start leaves the + # console saying "deploying" until the 600s default expires. + progressDeadlineSeconds: {{ . }} + {{- end }} + selector: + matchLabels: + {{- toYaml $p.selector | nindent 6 }} + template: + metadata: + labels: + {{- toYaml $p.labels | nindent 8 }} + annotations: + {{- toYaml $p.annotations | nindent 8 }} + spec: + automountServiceAccountToken: false + {{- if $s.runtime.runAsRoot }} + # Explicit, never by omission: manifests.py forces runAsNonRoot whenever this is absent. + securityContext: + runAsNonRoot: false + {{- end }} + {{- with (default (dict) $p.scheduling).nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with (default (dict) $p.scheduling).tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + containers: + - name: app + image: {{ $s.runtime.resolvedImage | quote }} + {{- with $s.runtime.command }} + command: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with $s.runtime.args }} + args: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + {{- toYaml $s.runtime.ports | nindent 12 }} + {{- if $s.env }} + env: + {{- range $name, $value := $s.env }} + - name: {{ $name }} + value: {{ $value | quote }} + {{- end }} + {{- else }} + env: [] + {{- end }} + resources: + {{- toYaml $p.resources | nindent 12 }} + # Pod Security Admission "restricted" is completed after render in manifests.py, so a + # chart cannot forget it. Only the container-level opt-out is stated here. + securityContext: + allowPrivilegeEscalation: false + {{- $add := list }} + {{- if $needsBind }}{{- $add = append $add "NET_BIND_SERVICE" }}{{- end }} + {{- if $s.runtime.runAsRoot }} + {{- /* A stock root image chowns its state and then drops its workers to a service + user; without these it starts as root and dies on the first chown. The set is + fixed by the platform, not reachable from a spec - see manifests.py. */}} + {{- $add = concat $add (list "CHOWN" "DAC_OVERRIDE" "FOWNER" "FSETID" "KILL" "SETGID" "SETUID") }} + {{- end }} + {{- with $add }} + capabilities: + add: + {{- toYaml . | nindent 16 }} + {{- end }} + readinessProbe: + httpGet: + path: {{ $s.healthCheck.path | quote }} + port: {{ $s.healthCheck.port }} + initialDelaySeconds: {{ $s.healthCheck.initialDelaySeconds }} diff --git a/templates/charts/generic-http-service/templates/ingress.yaml b/templates/charts/generic-http-service/templates/ingress.yaml new file mode 100644 index 0000000..c3b3136 --- /dev/null +++ b/templates/charts/generic-http-service/templates/ingress.yaml @@ -0,0 +1,35 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +{{- if $s.exposure.public -}} +{{- $i := $p.ingress -}} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: {{ $p.name }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} + annotations: + {{- toYaml $p.annotations | nindent 4 }} + # cert-manager watches this and issues a Let's Encrypt certificate into tls.secretName. + cert-manager.io/cluster-issuer: {{ $i.clusterIssuer | quote }} + nginx.ingress.kubernetes.io/ssl-redirect: "true" + nginx.ingress.kubernetes.io/force-ssl-redirect: "true" +spec: + ingressClassName: {{ $i.className | quote }} + tls: + - hosts: + - {{ $i.host | quote }} + secretName: {{ $p.name }}-tls + rules: + - host: {{ $i.host | quote }} + http: + paths: + - path: {{ $s.exposure.path | quote }} + pathType: Prefix + backend: + service: + name: {{ $p.name }} + port: + number: {{ $p.servicePort }} +{{- end }} diff --git a/templates/charts/generic-http-service/templates/service.yaml b/templates/charts/generic-http-service/templates/service.yaml new file mode 100644 index 0000000..7771416 --- /dev/null +++ b/templates/charts/generic-http-service/templates/service.yaml @@ -0,0 +1,15 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ $p.name }} + namespace: {{ $p.namespace }} +spec: + type: ClusterIP + selector: + {{- toYaml $p.selector | nindent 4 }} + ports: + - name: http + port: {{ $p.servicePort }} + targetPort: {{ (index $s.runtime.ports 0).name }} diff --git a/templates/charts/generic-http-service/values.yaml b/templates/charts/generic-http-service/values.yaml new file mode 100644 index 0000000..5ecf25a --- /dev/null +++ b/templates/charts/generic-http-service/values.yaml @@ -0,0 +1,8 @@ +# Defaults only. Every render supplies both layers explicitly: +# spec.* — the user's, projected from a schema-validated resolvedSpec +# platform.* — the gateway's, derived from platform config and never reachable from a spec +# +# Disjoint roots are deliberate: a spec cannot name a platform value at all, which is a stronger +# guarantee than relying on merge order. +spec: {} +platform: {} diff --git a/templates/charts/generic-inference-service-v1/Chart.yaml b/templates/charts/generic-inference-service-v1/Chart.yaml new file mode 100644 index 0000000..e972258 --- /dev/null +++ b/templates/charts/generic-inference-service-v1/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: generic-inference-service +description: HTTP inference runtime that downloads a pinned model during pod startup +type: application +version: 0.1.0 +appVersion: "1" diff --git a/templates/charts/generic-inference-service-v1/templates/deployment.yaml b/templates/charts/generic-inference-service-v1/templates/deployment.yaml new file mode 100644 index 0000000..9823dc7 --- /dev/null +++ b/templates/charts/generic-inference-service-v1/templates/deployment.yaml @@ -0,0 +1,105 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $p.workloadName }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} + annotations: + {{- toYaml $p.annotations | nindent 4 }} +spec: + replicas: {{ $s.replicas }} + progressDeadlineSeconds: {{ default 1800 (default (dict) $p.rollout).progressDeadlineSeconds }} + selector: + matchLabels: + {{- toYaml $p.selector | nindent 6 }} + template: + metadata: + labels: + {{- toYaml $p.labels | nindent 8 }} + annotations: + {{- toYaml $p.annotations | nindent 8 }} + spec: + automountServiceAccountToken: false + securityContext: + runAsNonRoot: {{ if $s.runtime.runAsRoot }}false{{ else }}true{{ end }} + fsGroup: 10001 + seccompProfile: + type: RuntimeDefault + {{- with (default (dict) $p.scheduling).nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with (default (dict) $p.scheduling).tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + - name: model + emptyDir: {} + initContainers: + - name: download-model + image: {{ $p.modelDownload.fetchImage | quote }} + command: ["python", "/app/model_fetcher.py"] + env: + - name: HF_REPO_ID + value: {{ $s.resolvedModel.source.repoId | quote }} + - name: HF_COMMIT + value: {{ $s.resolvedModel.source.commit | quote }} + - name: MODEL_MAX_BYTES + value: {{ $p.modelDownload.maxBytes | quote }} + - name: HF_HOME + value: /tmp/huggingface + {{- with $s.resolvedModel.credentialRef }} + - name: HF_TOKEN + valueFrom: + secretKeyRef: + name: {{ . | quote }} + key: token + {{- end }} + volumeMounts: + - name: model + mountPath: /models + resources: + {{- toYaml $p.modelDownload.resources | nindent 12 }} + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: [ALL] + containers: + - name: runtime + image: {{ $s.runtime.resolvedImage | quote }} + {{- with $s.runtime.command }} + command: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with $s.runtime.args }} + args: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + {{- toYaml $s.runtime.ports | nindent 12 }} + env: + - name: MODEL_PATH + value: /models/model + {{- range $name, $value := $s.env }} + - name: {{ $name }} + value: {{ $value | quote }} + {{- end }} + volumeMounts: + - name: model + mountPath: /models + readOnly: true + resources: + {{- toYaml $p.resources | nindent 12 }} + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: [ALL] + readinessProbe: + httpGet: + path: {{ $s.healthCheck.path | quote }} + port: {{ $s.healthCheck.port }} + initialDelaySeconds: {{ $s.healthCheck.initialDelaySeconds }} diff --git a/templates/charts/generic-inference-service-v1/templates/service.yaml b/templates/charts/generic-inference-service-v1/templates/service.yaml new file mode 100644 index 0000000..76e3320 --- /dev/null +++ b/templates/charts/generic-inference-service-v1/templates/service.yaml @@ -0,0 +1,22 @@ +{{- $s := .Values.spec -}} +{{- $p := .Values.platform -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ $p.serviceName }} + namespace: {{ $p.namespace }} + labels: + {{- toYaml $p.labels | nindent 4 }} + annotations: + {{- toYaml $p.annotations | nindent 4 }} +spec: + type: ClusterIP + selector: + {{- toYaml $p.selector | nindent 4 }} + ports: + {{- range $s.runtime.ports }} + - name: {{ .name }} + port: {{ .containerPort }} + targetPort: {{ .containerPort }} + protocol: TCP + {{- end }} diff --git a/templates/charts/generic-inference-service-v1/values.yaml b/templates/charts/generic-inference-service-v1/values.yaml new file mode 100644 index 0000000..be77069 --- /dev/null +++ b/templates/charts/generic-inference-service-v1/values.yaml @@ -0,0 +1,12 @@ +spec: {} +platform: + modelDownload: + fetchImage: example/model-fetcher@sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb + maxBytes: 20000000000 + resources: + requests: + cpu: 250m + memory: 512Mi + limits: + cpu: "2" + memory: 2Gi diff --git a/templates/charts/minio-service-v1/Chart.yaml b/templates/charts/minio-service-v1/Chart.yaml new file mode 100644 index 0000000..18beddd --- /dev/null +++ b/templates/charts/minio-service-v1/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: minio-service +description: Pass-through chart for data-service objects built by the cluster gateway +type: application +version: 1.0.0 +appVersion: "1" diff --git a/templates/charts/minio-service-v1/templates/resources.yaml b/templates/charts/minio-service-v1/templates/resources.yaml new file mode 100644 index 0000000..e36eb55 --- /dev/null +++ b/templates/charts/minio-service-v1/templates/resources.yaml @@ -0,0 +1,5 @@ +{{- /* The gateway builds and checks every object; this chart only emits them. */}} +{{- range .Values.platform.manifests }} +--- +{{ toYaml . }} +{{- end }} diff --git a/templates/charts/minio-service-v1/values.yaml b/templates/charts/minio-service-v1/values.yaml new file mode 100644 index 0000000..20ceeaa --- /dev/null +++ b/templates/charts/minio-service-v1/values.yaml @@ -0,0 +1,2 @@ +spec: {} +platform: {} diff --git a/templates/charts/minio-service-v2/Chart.yaml b/templates/charts/minio-service-v2/Chart.yaml new file mode 100644 index 0000000..5a97a0f --- /dev/null +++ b/templates/charts/minio-service-v2/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: minio-service +description: Standalone data-service objects built by the cluster gateway +type: application +version: 2.0.0 +appVersion: "2" diff --git a/templates/charts/minio-service-v2/templates/resources.yaml b/templates/charts/minio-service-v2/templates/resources.yaml new file mode 100644 index 0000000..e36eb55 --- /dev/null +++ b/templates/charts/minio-service-v2/templates/resources.yaml @@ -0,0 +1,5 @@ +{{- /* The gateway builds and checks every object; this chart only emits them. */}} +{{- range .Values.platform.manifests }} +--- +{{ toYaml . }} +{{- end }} diff --git a/templates/charts/minio-service-v2/values.yaml b/templates/charts/minio-service-v2/values.yaml new file mode 100644 index 0000000..2bdbb1a --- /dev/null +++ b/templates/charts/minio-service-v2/values.yaml @@ -0,0 +1,3 @@ +spec: {} +platform: + manifests: [] diff --git a/templates/charts/postgresql-service-v1/Chart.yaml b/templates/charts/postgresql-service-v1/Chart.yaml new file mode 100644 index 0000000..d1895f0 --- /dev/null +++ b/templates/charts/postgresql-service-v1/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: postgresql-service +description: Pass-through chart for data-service objects built by the cluster gateway +type: application +version: 1.0.0 +appVersion: "1" diff --git a/templates/charts/postgresql-service-v1/templates/resources.yaml b/templates/charts/postgresql-service-v1/templates/resources.yaml new file mode 100644 index 0000000..e36eb55 --- /dev/null +++ b/templates/charts/postgresql-service-v1/templates/resources.yaml @@ -0,0 +1,5 @@ +{{- /* The gateway builds and checks every object; this chart only emits them. */}} +{{- range .Values.platform.manifests }} +--- +{{ toYaml . }} +{{- end }} diff --git a/templates/charts/postgresql-service-v1/values.yaml b/templates/charts/postgresql-service-v1/values.yaml new file mode 100644 index 0000000..20ceeaa --- /dev/null +++ b/templates/charts/postgresql-service-v1/values.yaml @@ -0,0 +1,2 @@ +spec: {} +platform: {} diff --git a/templates/charts/postgresql-service-v2/Chart.yaml b/templates/charts/postgresql-service-v2/Chart.yaml new file mode 100644 index 0000000..91aad72 --- /dev/null +++ b/templates/charts/postgresql-service-v2/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: postgresql-service +description: Standalone data-service objects built by the cluster gateway +type: application +version: 2.0.0 +appVersion: "2" diff --git a/templates/charts/postgresql-service-v2/templates/resources.yaml b/templates/charts/postgresql-service-v2/templates/resources.yaml new file mode 100644 index 0000000..e36eb55 --- /dev/null +++ b/templates/charts/postgresql-service-v2/templates/resources.yaml @@ -0,0 +1,5 @@ +{{- /* The gateway builds and checks every object; this chart only emits them. */}} +{{- range .Values.platform.manifests }} +--- +{{ toYaml . }} +{{- end }} diff --git a/templates/charts/postgresql-service-v2/values.yaml b/templates/charts/postgresql-service-v2/values.yaml new file mode 100644 index 0000000..2bdbb1a --- /dev/null +++ b/templates/charts/postgresql-service-v2/values.yaml @@ -0,0 +1,3 @@ +spec: {} +platform: + manifests: [] diff --git a/templates/charts/redis-service-v1/Chart.yaml b/templates/charts/redis-service-v1/Chart.yaml new file mode 100644 index 0000000..16701ed --- /dev/null +++ b/templates/charts/redis-service-v1/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: redis-service +description: Pass-through chart for data-service objects built by the cluster gateway +type: application +version: 1.0.0 +appVersion: "1" diff --git a/templates/charts/redis-service-v1/templates/resources.yaml b/templates/charts/redis-service-v1/templates/resources.yaml new file mode 100644 index 0000000..e36eb55 --- /dev/null +++ b/templates/charts/redis-service-v1/templates/resources.yaml @@ -0,0 +1,5 @@ +{{- /* The gateway builds and checks every object; this chart only emits them. */}} +{{- range .Values.platform.manifests }} +--- +{{ toYaml . }} +{{- end }} diff --git a/templates/charts/redis-service-v1/values.yaml b/templates/charts/redis-service-v1/values.yaml new file mode 100644 index 0000000..20ceeaa --- /dev/null +++ b/templates/charts/redis-service-v1/values.yaml @@ -0,0 +1,2 @@ +spec: {} +platform: {} diff --git a/templates/charts/redis-service-v2/Chart.yaml b/templates/charts/redis-service-v2/Chart.yaml new file mode 100644 index 0000000..31495c6 --- /dev/null +++ b/templates/charts/redis-service-v2/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: redis-service +description: Standalone data-service objects built by the cluster gateway +type: application +version: 2.0.0 +appVersion: "2" diff --git a/templates/charts/redis-service-v2/templates/resources.yaml b/templates/charts/redis-service-v2/templates/resources.yaml new file mode 100644 index 0000000..e36eb55 --- /dev/null +++ b/templates/charts/redis-service-v2/templates/resources.yaml @@ -0,0 +1,5 @@ +{{- /* The gateway builds and checks every object; this chart only emits them. */}} +{{- range .Values.platform.manifests }} +--- +{{ toYaml . }} +{{- end }} diff --git a/templates/charts/redis-service-v2/values.yaml b/templates/charts/redis-service-v2/values.yaml new file mode 100644 index 0000000..2bdbb1a --- /dev/null +++ b/templates/charts/redis-service-v2/values.yaml @@ -0,0 +1,3 @@ +spec: {} +platform: + manifests: [] diff --git a/templates/digest.json b/templates/digest.json new file mode 100644 index 0000000..71c7f58 --- /dev/null +++ b/templates/digest.json @@ -0,0 +1 @@ +{"format":"template/v1","templateDigest":"sha256:63d120680f8ca2b47ab39d84d8c176d06ee3bb23c073e64afe352e82e43ac79d"} diff --git a/templates/generic-http-service.v5.digest.json b/templates/generic-http-service.v5.digest.json new file mode 100644 index 0000000..a184cb6 --- /dev/null +++ b/templates/generic-http-service.v5.digest.json @@ -0,0 +1,4 @@ +{ + "format": "template/v1", + "templateDigest": "sha256:670d3d029444b9f0765d1f1523bd33bd1af4e866cd6da68c1b06f16fbefd9499" +} diff --git a/templates/minio-service.v1.digest.json b/templates/minio-service.v1.digest.json new file mode 100644 index 0000000..bc6c90a --- /dev/null +++ b/templates/minio-service.v1.digest.json @@ -0,0 +1,4 @@ +{ + "format": "template/v1", + "templateDigest": "sha256:8737127d5398f0999f879a2e28654805c340ec4598d2589639616888c982afd7" +} diff --git a/templates/minio-service.v2.digest.json b/templates/minio-service.v2.digest.json new file mode 100644 index 0000000..db8e70b --- /dev/null +++ b/templates/minio-service.v2.digest.json @@ -0,0 +1,4 @@ +{ + "format": "template/v1", + "templateDigest": "sha256:9d7118b9ae99ce6a983abf27d772f23f0a554f67bf7ab87f44a7d2022a4c01ec" +} diff --git a/templates/postgresql-service.v1.digest.json b/templates/postgresql-service.v1.digest.json new file mode 100644 index 0000000..7e855a9 --- /dev/null +++ b/templates/postgresql-service.v1.digest.json @@ -0,0 +1,4 @@ +{ + "format": "template/v1", + "templateDigest": "sha256:da4dee5b9fb45cd4578bda4a5e80f65463b3c267ea7f41f00427cae64b73883c" +} diff --git a/templates/postgresql-service.v2.digest.json b/templates/postgresql-service.v2.digest.json new file mode 100644 index 0000000..a9df73e --- /dev/null +++ b/templates/postgresql-service.v2.digest.json @@ -0,0 +1,4 @@ +{ + "format": "template/v1", + "templateDigest": "sha256:27f3d22e13cd7d36524c9194907963e5bad0c0ab4ebd48439051f9b674199729" +} diff --git a/templates/redis-service.v1.digest.json b/templates/redis-service.v1.digest.json new file mode 100644 index 0000000..b57508c --- /dev/null +++ b/templates/redis-service.v1.digest.json @@ -0,0 +1,4 @@ +{ + "format": "template/v1", + "templateDigest": "sha256:39b5fe1eb69a6238c44a2b812c46d75cd8410576143750c1b629d8e8fd202cd4" +} diff --git a/templates/redis-service.v2.digest.json b/templates/redis-service.v2.digest.json new file mode 100644 index 0000000..5d689ec --- /dev/null +++ b/templates/redis-service.v2.digest.json @@ -0,0 +1,4 @@ +{ + "format": "template/v1", + "templateDigest": "sha256:88a600d4d5f5ebb9191417196f1bcede486191cbb899d80f26e1151714f68164" +} diff --git a/templates/schemas/generic-http-service.v1.json b/templates/schemas/generic-http-service.v1.json new file mode 100644 index 0000000..e6d3cb7 --- /dev/null +++ b/templates/schemas/generic-http-service.v1.json @@ -0,0 +1,116 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/generic-http-service/v1", + "title": "generic-http-service@v1", + "description": "One HTTP workload: a Deployment and a ClusterIP Service for in-cluster traffic.", + "type": "object", + "additionalProperties": false, + "required": ["templateRef", "metadata", "runtime", "replicas", "resources", "healthCheck"], + "properties": { + "templateRef": { + "description": "The contract this spec is frozen against. Never a chart coordinate.", + "type": "object", + "additionalProperties": false, + "required": ["name", "version"], + "properties": { + "name": {"type": "string", "pattern": "^[a-z][a-z0-9-]{0,62}$"}, + "version": {"type": "string", "pattern": "^v[0-9]+$"} + } + }, + "type": {"const": "web"}, + "metadata": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": {"type": "string"}, + "owner": {"type": "string"}, + "labels": { + "description": "The platform/ prefix is reserved: the gateway writes its own identity labels there and a spec must not collide with them.", + "type": "object", + "propertyNames": {"not": {"pattern": "^platform\\.example/"}}, + "additionalProperties": {"type": "string"} + } + } + }, + "runtime": { + "type": "object", + "additionalProperties": false, + "required": ["image", "resolvedImage", "ports"], + "properties": { + "image": {"type": "string"}, + "resolvedImage": { + "description": "Digest-pinned by the Backend; a tag would break reproducibility.", + "type": "string", + "pattern": "^[^ @]+@sha256:[a-f0-9]{64}$" + }, + "command": {"type": "array", "items": {"type": "string"}}, + "args": {"type": "array", "items": {"type": "string"}}, + "ports": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "additionalProperties": false, + "required": ["name", "containerPort"], + "properties": { + "name": {"type": "string", "pattern": "^[a-z][a-z0-9-]{0,14}$"}, + "containerPort": {"type": "integer", "minimum": 1, "maximum": 65535} + } + } + }, + "runAsRoot": { + "description": "Run the container as root, for images that cannot drop privileges. Every other restricted control still applies; a port below 1024 also gets NET_BIND_SERVICE, without which root still cannot bind it.", + "type": "boolean" + } + } + }, + "env": { + "type": "object", + "propertyNames": {"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"}, + "additionalProperties": {"type": "string"} + }, + "replicas": {"type": "integer", "minimum": 1, "maximum": 10}, + "resources": { + "type": "object", + "additionalProperties": false, + "required": ["size"], + "properties": {"size": {"enum": ["nano", "small", "medium", "large"]}} + }, + "healthCheck": { + "type": "object", + "additionalProperties": false, + "required": ["path", "port", "initialDelaySeconds"], + "properties": { + "path": {"type": "string", "pattern": "^/"}, + "port": {"type": "integer", "minimum": 1, "maximum": 65535}, + "initialDelaySeconds": {"type": "integer", "minimum": 0, "maximum": 600} + } + }, + "exposure": { + "description": "public renders an Ingress on the platform's wildcard host; path stays pinned to \"/\" because the template routes the whole host to one Service.", + "type": "object", + "additionalProperties": false, + "properties": {"public": {"type": "boolean"}, "path": {"const": "/"}} + }, + "secretRefs": {"type": "array", "maxItems": 0}, + "mounts": {"type": "array", "maxItems": 0}, + "dependencies": {"type": "array", "maxItems": 0}, + "contract": {"type": "object", "additionalProperties": false} + }, + "allOf": [ + { + "$comment": "A public deployment is addressed by a hostname built from the service name, so that name has to be present. It travels in metadata.labels.service, optional for a private deployment; requiring it only when exposure.public is true keeps the dependency visible in the published contract instead of surfacing as a render error.", + "if": { + "type": "object", + "required": ["exposure"], + "properties": {"exposure": {"required": ["public"], "properties": {"public": {"const": true}}}} + }, + "then": { + "properties": { + "metadata": {"required": ["labels"], "properties": {"labels": {"required": ["service"]}}} + } + } + } + ] +} diff --git a/templates/schemas/generic-http-service.v2.json b/templates/schemas/generic-http-service.v2.json new file mode 100644 index 0000000..3b5fc1c --- /dev/null +++ b/templates/schemas/generic-http-service.v2.json @@ -0,0 +1,92 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/generic-http-service/v2", + "title": "generic-http-service@v2", + "description": "One HTTP workload with a stable ClusterIP Service per logical service.", + "type": "object", + "additionalProperties": false, + "required": ["templateRef", "metadata", "runtime", "replicas", "resources", "healthCheck"], + "properties": { + "templateRef": { + "type": "object", "additionalProperties": false, "required": ["name", "version"], + "properties": { + "name": {"const": "generic-http-service"}, + "version": {"const": "v2"} + } + }, + "type": {"const": "web"}, + "metadata": { + "type": "object", "additionalProperties": false, + "properties": { + "description": {"type": "string"}, "owner": {"type": "string"}, + "labels": { + "type": "object", "propertyNames": {"not": {"pattern": "^platform\\.example/"}}, + "additionalProperties": {"type": "string"} + } + } + }, + "runtime": { + "type": "object", "additionalProperties": false, "required": ["image", "resolvedImage", "ports"], + "properties": { + "image": {"type": "string"}, + "resolvedImage": {"type": "string", "pattern": "^[^ @]+@sha256:[a-f0-9]{64}$"}, + "command": {"type": "array", "items": {"type": "string"}}, + "args": {"type": "array", "items": {"type": "string"}}, + "ports": { + "type": "array", "minItems": 1, "maxItems": 1, + "items": { + "type": "object", "additionalProperties": false, "required": ["name", "containerPort"], + "properties": { + "name": {"const": "http"}, + "containerPort": {"type": "integer", "minimum": 1, "maximum": 65535} + } + } + }, + "runAsRoot": {"type": "boolean"} + } + }, + "env": { + "type": "object", "propertyNames": {"pattern": "^[A-Za-z_][A-Za-z0-9_]*$"}, + "additionalProperties": {"type": "string"} + }, + "replicas": {"type": "integer", "minimum": 1, "maximum": 10}, + "resources": { + "type": "object", "additionalProperties": false, "required": ["size"], + "properties": {"size": {"enum": ["nano", "small", "medium", "large"]}} + }, + "healthCheck": { + "type": "object", "additionalProperties": false, + "required": ["path", "port", "initialDelaySeconds"], + "properties": { + "path": {"type": "string", "pattern": "^/"}, + "port": {"type": "integer", "minimum": 1, "maximum": 65535}, + "initialDelaySeconds": {"type": "integer", "minimum": 0, "maximum": 600} + } + }, + "exposure": { + "type": "object", "additionalProperties": false, + "properties": {"public": {"type": "boolean"}, "path": {"const": "/"}} + }, + "secretRefs": {"type": "array", "maxItems": 0}, + "mounts": {"type": "array", "maxItems": 0}, + "dependencies": { + "type": "array", "maxItems": 20, + "items": { + "type": "object", "additionalProperties": false, + "required": ["serviceId", "alias", "protocol"], + "properties": { + "serviceId": {"type": "string", "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$"}, + "alias": {"type": "string", "pattern": "^[A-Z][A-Z0-9_]{0,48}$"}, + "protocol": {"const": "http"} + } + } + }, + "contract": {"type": "object", "additionalProperties": false} + }, + "allOf": [ + { + "if": {"required": ["exposure"], "properties": {"exposure": {"required": ["public"], "properties": {"public": {"const": true}}}}}, + "then": {"properties": {"metadata": {"required": ["labels"], "properties": {"labels": {"required": ["service"]}}}}} + } + ] +} diff --git a/templates/schemas/generic-http-service.v3.json b/templates/schemas/generic-http-service.v3.json new file mode 100644 index 0000000..374b361 --- /dev/null +++ b/templates/schemas/generic-http-service.v3.json @@ -0,0 +1,305 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/generic-http-service/v3", + "title": "generic-http-service@v3", + "description": "One HTTP workload with a stable ClusterIP Service per logical service.", + "type": "object", + "additionalProperties": false, + "required": [ + "templateRef", + "metadata", + "runtime", + "replicas", + "resources", + "healthCheck" + ], + "properties": { + "templateRef": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "version" + ], + "properties": { + "name": { + "const": "generic-http-service" + }, + "version": { + "const": "v3" + } + } + }, + "type": { + "const": "web" + }, + "metadata": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "owner": { + "type": "string" + }, + "labels": { + "type": "object", + "propertyNames": { + "not": { + "pattern": "^platform\\.example/" + } + }, + "additionalProperties": { + "type": "string" + } + } + } + }, + "runtime": { + "type": "object", + "additionalProperties": false, + "required": [ + "image", + "resolvedImage", + "ports" + ], + "properties": { + "image": { + "type": "string" + }, + "resolvedImage": { + "type": "string", + "pattern": "^[^ @]+@sha256:[a-f0-9]{64}$" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "ports": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "containerPort" + ], + "properties": { + "name": { + "const": "http" + }, + "containerPort": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + } + } + } + }, + "runAsRoot": { + "type": "boolean" + } + } + }, + "env": { + "type": "object", + "propertyNames": { + "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" + }, + "additionalProperties": { + "type": "string" + } + }, + "replicas": { + "type": "integer", + "minimum": 1, + "maximum": 10 + }, + "resources": { + "type": "object", + "additionalProperties": false, + "required": [ + "size" + ], + "properties": { + "size": { + "enum": [ + "nano", + "small", + "medium", + "large" + ] + } + } + }, + "healthCheck": { + "type": "object", + "additionalProperties": false, + "required": [ + "path", + "port", + "initialDelaySeconds" + ], + "properties": { + "path": { + "type": "string", + "pattern": "^/" + }, + "port": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + }, + "initialDelaySeconds": { + "type": "integer", + "minimum": 0, + "maximum": 600 + } + } + }, + "exposure": { + "type": "object", + "additionalProperties": false, + "properties": { + "public": { + "type": "boolean" + }, + "path": { + "const": "/" + } + } + }, + "secretRefs": { + "type": "array", + "maxItems": 0 + }, + "dependencies": { + "type": "array", + "maxItems": 20, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "serviceId", + "alias", + "protocol" + ], + "properties": { + "serviceId": { + "type": "string", + "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$" + }, + "alias": { + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]{0,48}$" + }, + "protocol": { + "const": "http" + } + } + } + }, + "contract": { + "type": "object", + "additionalProperties": false + }, + "volumeAttachments": { + "type": "array", + "maxItems": 8, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "mountPath", + "storageProfile", + "size" + ], + "properties": { + "name": { + "type": "string", + "pattern": "^[a-z0-9](?:[-a-z0-9]{0,18}[a-z0-9])?$" + }, + "mountPath": { + "type": "string", + "pattern": "^/(?!/).+" + }, + "storageProfile": { + "const": "local-data" + }, + "size": { + "type": "string", + "pattern": "^[0-9]+(?:\\.[0-9]+)?(?:[EPTGMK]i?|m)?$" + } + } + } + } + }, + "allOf": [ + { + "if": { + "required": [ + "exposure" + ], + "properties": { + "exposure": { + "required": [ + "public" + ], + "properties": { + "public": { + "const": true + } + } + } + } + }, + "then": { + "properties": { + "metadata": { + "required": [ + "labels" + ], + "properties": { + "labels": { + "required": [ + "service" + ] + } + } + } + } + } + }, + { + "if": { + "required": [ + "volumeAttachments" + ], + "properties": { + "volumeAttachments": { + "minItems": 1 + } + } + }, + "then": { + "properties": { + "replicas": { + "const": 1 + } + } + } + } + ] +} diff --git a/templates/schemas/generic-http-service.v4.json b/templates/schemas/generic-http-service.v4.json new file mode 100644 index 0000000..24129d2 --- /dev/null +++ b/templates/schemas/generic-http-service.v4.json @@ -0,0 +1,330 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/generic-http-service/v4", + "title": "generic-http-service@v4", + "description": "One HTTP workload with a stable ClusterIP Service per logical service.", + "type": "object", + "additionalProperties": false, + "required": [ + "templateRef", + "metadata", + "runtime", + "replicas", + "resources", + "healthCheck" + ], + "properties": { + "templateRef": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "version" + ], + "properties": { + "name": { + "const": "generic-http-service" + }, + "version": { + "const": "v4" + } + } + }, + "type": { + "const": "web" + }, + "metadata": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "owner": { + "type": "string" + }, + "labels": { + "type": "object", + "propertyNames": { + "not": { + "pattern": "^platform\\.example/" + } + }, + "additionalProperties": { + "type": "string" + } + } + } + }, + "runtime": { + "type": "object", + "additionalProperties": false, + "required": [ + "image", + "resolvedImage", + "ports" + ], + "properties": { + "image": { + "type": "string" + }, + "resolvedImage": { + "type": "string", + "pattern": "^[^ @]+@sha256:[a-f0-9]{64}$" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "ports": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "containerPort" + ], + "properties": { + "name": { + "type": "string", + "maxLength": 15, + "pattern": "^(?=[a-z0-9-]*[a-z])[a-z0-9]+(?:-[a-z0-9]+)*$" + }, + "containerPort": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + } + } + } + }, + "runAsRoot": { + "type": "boolean" + } + } + }, + "env": { + "type": "object", + "propertyNames": { + "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" + }, + "additionalProperties": { + "type": "string" + } + }, + "replicas": { + "type": "integer", + "minimum": 1, + "maximum": 10 + }, + "resources": { + "type": "object", + "additionalProperties": false, + "required": [ + "size" + ], + "properties": { + "size": { + "enum": [ + "nano", + "small", + "medium", + "large" + ] + } + } + }, + "healthCheck": { + "type": "object", + "additionalProperties": false, + "required": [ + "path", + "port", + "initialDelaySeconds" + ], + "properties": { + "path": { + "type": "string", + "pattern": "^/" + }, + "port": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + }, + "initialDelaySeconds": { + "type": "integer", + "minimum": 0, + "maximum": 600 + } + } + }, + "exposure": { + "type": "object", + "additionalProperties": false, + "properties": { + "public": { + "type": "boolean" + }, + "path": { + "const": "/" + } + } + }, + "secretRefs": { + "type": "array", + "maxItems": 0 + }, + "dependencies": { + "type": "array", + "maxItems": 20, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "serviceId", + "alias", + "protocol", + "portName" + ], + "properties": { + "serviceId": { + "type": "string", + "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$" + }, + "alias": { + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]{0,48}$" + }, + "protocol": { + "const": "http" + }, + "portName": { + "type": "string", + "pattern": "^[a-z0-9](?:[-a-z0-9]{0,18}[a-z0-9])?$" + } + } + } + }, + "contract": { + "type": "object", + "additionalProperties": false + }, + "volumeAttachments": { + "type": "array", + "maxItems": 8, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "mountPath", + "storageProfile", + "size" + ], + "properties": { + "name": { + "type": "string", + "pattern": "^[a-z0-9](?:[-a-z0-9]{0,18}[a-z0-9])?$" + }, + "mountPath": { + "type": "string", + "pattern": "^/(?!/).+" + }, + "storageProfile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,31}$" + }, + "size": { + "type": "string", + "pattern": "^[0-9]+(?:\\.[0-9]+)?(?:[EPTGMK]i?|m)?$" + }, + "readOnly": { + "type": "boolean", + "default": true + } + } + } + } + }, + "allOf": [ + { + "if": { + "required": [ + "exposure" + ], + "properties": { + "exposure": { + "required": [ + "public" + ], + "properties": { + "public": { + "const": true + } + } + } + } + }, + "then": { + "properties": { + "metadata": { + "required": [ + "labels" + ], + "properties": { + "labels": { + "required": [ + "service" + ] + } + } + } + } + } + }, + { + "if": { + "required": [ + "volumeAttachments" + ], + "properties": { + "volumeAttachments": { + "minItems": 1 + } + } + }, + "then": { + "properties": { + "replicas": { + "const": 1 + } + } + } + }, + { + "if": { + "properties": { + "runtime": { + "properties": { + "ports": { + "minItems": 1 + } + } + } + } + }, + "then": {} + } + ] +} diff --git a/templates/schemas/generic-http-service.v5.json b/templates/schemas/generic-http-service.v5.json new file mode 100644 index 0000000..21d47f2 --- /dev/null +++ b/templates/schemas/generic-http-service.v5.json @@ -0,0 +1,251 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/generic-http-service/v5", + "title": "generic-http-service@v5", + "description": "Port-free HTTP workload with headless discovery and independently managed networking.", + "type": "object", + "additionalProperties": false, + "required": [ + "templateRef", + "metadata", + "runtime", + "replicas", + "resources" + ], + "properties": { + "templateRef": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "version" + ], + "properties": { + "name": { + "const": "generic-http-service" + }, + "version": { + "const": "v5" + } + } + }, + "type": { + "const": "web" + }, + "metadata": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "owner": { + "type": "string" + }, + "labels": { + "type": "object", + "propertyNames": { + "not": { + "pattern": "^platform\\.example/" + } + }, + "additionalProperties": { + "type": "string" + } + } + } + }, + "runtime": { + "type": "object", + "additionalProperties": false, + "required": [ + "image", + "resolvedImage" + ], + "properties": { + "image": { + "type": "string" + }, + "resolvedImage": { + "type": "string", + "pattern": "^[^ @]+@sha256:[a-f0-9]{64}$" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "runAsRoot": { + "type": "boolean" + } + } + }, + "env": { + "type": "object", + "propertyNames": { + "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" + }, + "additionalProperties": { + "type": "string" + } + }, + "replicas": { + "type": "integer", + "minimum": 1, + "maximum": 10 + }, + "resources": { + "type": "object", + "additionalProperties": false, + "required": [ + "size" + ], + "properties": { + "size": { + "enum": [ + "nano", + "small", + "medium", + "large" + ] + } + } + }, + "healthCheck": { + "type": "object", + "additionalProperties": false, + "required": [ + "path", + "port", + "initialDelaySeconds" + ], + "properties": { + "path": { + "type": "string", + "pattern": "^/" + }, + "port": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + }, + "initialDelaySeconds": { + "type": "integer", + "minimum": 0, + "maximum": 600 + } + } + }, + "secretRefs": { + "type": "array", + "maxItems": 0 + }, + "dependencies": { + "type": "array", + "maxItems": 20, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "serviceId", + "alias", + "protocol", + "port" + ], + "properties": { + "serviceId": { + "type": "string", + "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$" + }, + "alias": { + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]{0,48}$" + }, + "protocol": { + "const": "http" + }, + "port": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + }, + "routingMode": { + "enum": [ + "headless", + "clusterIP" + ], + "default": "headless" + } + } + } + }, + "contract": { + "type": "object", + "additionalProperties": false + }, + "volumeAttachments": { + "type": "array", + "maxItems": 8, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "mountPath", + "storageProfile", + "size" + ], + "properties": { + "name": { + "type": "string", + "pattern": "^[a-z0-9](?:[-a-z0-9]{0,18}[a-z0-9])?$" + }, + "mountPath": { + "type": "string", + "pattern": "^/(?!/).+" + }, + "storageProfile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,31}$" + }, + "size": { + "type": "string", + "pattern": "^[0-9]+(?:\\.[0-9]+)?(?:[EPTGMK]i?|m)?$" + }, + "readOnly": { + "type": "boolean", + "default": true + } + } + } + } + }, + "allOf": [ + { + "if": { + "required": [ + "volumeAttachments" + ], + "properties": { + "volumeAttachments": { + "minItems": 1 + } + } + }, + "then": { + "properties": { + "replicas": { + "const": 1 + } + } + } + } + ] +} diff --git a/templates/schemas/generic-inference-service.v1.json b/templates/schemas/generic-inference-service.v1.json new file mode 100644 index 0000000..5841b5d --- /dev/null +++ b/templates/schemas/generic-inference-service.v1.json @@ -0,0 +1,343 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/generic-inference-service/v1", + "title": "generic-inference-service@v1", + "description": "Generic HTTP runtime that downloads a pinned Hugging Face model during pod startup", + "type": "object", + "additionalProperties": false, + "required": [ + "templateRef", + "metadata", + "runtime", + "replicas", + "resources", + "healthCheck", + "resolvedModel" + ], + "properties": { + "templateRef": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "version" + ], + "properties": { + "name": { + "const": "generic-inference-service" + }, + "version": { + "const": "v1" + } + } + }, + "type": { + "const": "inference" + }, + "metadata": { + "type": "object", + "additionalProperties": false, + "properties": { + "description": { + "type": "string" + }, + "owner": { + "type": "string" + }, + "labels": { + "type": "object", + "propertyNames": { + "not": { + "pattern": "^platform\\.example/" + } + }, + "additionalProperties": { + "type": "string" + } + } + } + }, + "runtime": { + "type": "object", + "additionalProperties": false, + "required": [ + "image", + "resolvedImage", + "ports" + ], + "properties": { + "image": { + "type": "string" + }, + "resolvedImage": { + "type": "string", + "pattern": "^[^ @]+@sha256:[a-f0-9]{64}$" + }, + "command": { + "type": "array", + "items": { + "type": "string" + } + }, + "args": { + "type": "array", + "items": { + "type": "string" + } + }, + "ports": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "name", + "containerPort" + ], + "properties": { + "name": { + "type": "string", + "maxLength": 15, + "pattern": "^(?=[a-z0-9-]*[a-z])[a-z0-9]+(?:-[a-z0-9]+)*$" + }, + "containerPort": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + } + } + } + }, + "runAsRoot": { + "type": "boolean" + } + } + }, + "env": { + "type": "object", + "propertyNames": { + "allOf": [ + { + "pattern": "^[A-Za-z_][A-Za-z0-9_]*$" + }, + { + "not": { + "const": "MODEL_PATH" + } + } + ] + }, + "additionalProperties": { + "type": "string" + } + }, + "replicas": { + "type": "integer", + "minimum": 0, + "maximum": 10 + }, + "resources": { + "type": "object", + "additionalProperties": false, + "required": [ + "size" + ], + "properties": { + "size": { + "enum": [ + "nano", + "small", + "medium", + "large" + ] + } + } + }, + "healthCheck": { + "type": "object", + "additionalProperties": false, + "required": [ + "path", + "port", + "initialDelaySeconds" + ], + "properties": { + "path": { + "type": "string", + "pattern": "^/" + }, + "port": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + }, + "initialDelaySeconds": { + "type": "integer", + "minimum": 0, + "maximum": 600 + } + } + }, + "exposure": { + "type": "object", + "additionalProperties": false, + "properties": { + "public": { + "const": false + }, + "path": { + "const": "/" + } + } + }, + "secretRefs": { + "type": "array", + "maxItems": 0 + }, + "dependencies": { + "type": "array", + "maxItems": 20, + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "serviceId", + "alias", + "protocol", + "portName" + ], + "properties": { + "serviceId": { + "type": "string", + "pattern": "^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$" + }, + "alias": { + "type": "string", + "pattern": "^[A-Z][A-Z0-9_]{0,48}$" + }, + "protocol": { + "const": "http" + }, + "portName": { + "type": "string", + "pattern": "^[a-z0-9](?:[-a-z0-9]{0,18}[a-z0-9])?$" + } + } + } + }, + "contract": { + "type": "object", + "additionalProperties": false + }, + "resolvedModel": { + "type": "object", + "additionalProperties": false, + "required": [ + "source" + ], + "properties": { + "source": { + "type": "object", + "additionalProperties": false, + "required": [ + "type", + "repoId", + "commit" + ], + "properties": { + "type": { + "const": "huggingface" + }, + "repoId": { + "type": "string", + "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*/[A-Za-z0-9][A-Za-z0-9._-]*$", + "maxLength": 256 + }, + "commit": { + "type": "string", + "pattern": "^[0-9a-f]{40}$" + } + } + }, + "credentialRef": { + "type": [ + "string", + "null" + ], + "pattern": "^[a-z0-9](?:[-a-z0-9]{0,61}[a-z0-9])?$" + } + } + } + }, + "allOf": [ + { + "if": { + "required": [ + "exposure" + ], + "properties": { + "exposure": { + "required": [ + "public" + ], + "properties": { + "public": { + "const": true + } + } + } + } + }, + "then": { + "properties": { + "metadata": { + "required": [ + "labels" + ], + "properties": { + "labels": { + "required": [ + "service" + ] + } + } + } + } + } + }, + { + "if": { + "required": [ + "volumeAttachments" + ], + "properties": { + "volumeAttachments": { + "minItems": 1 + } + } + }, + "then": { + "properties": { + "replicas": { + "const": 1 + } + } + } + }, + { + "if": { + "properties": { + "runtime": { + "properties": { + "ports": { + "minItems": 1 + } + } + } + } + }, + "then": {} + } + ] +} diff --git a/templates/schemas/minio-service.v1.json b/templates/schemas/minio-service.v1.json new file mode 100644 index 0000000..dff7c29 --- /dev/null +++ b/templates/schemas/minio-service.v1.json @@ -0,0 +1,123 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/minio-service/v1", + "title": "minio-service@v1", + "description": "Distributed MinIO object storage (legacy support level); objects are built by the cluster gateway", + "type": "object", + "additionalProperties": false, + "properties": { + "templateRef": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "const": "minio-service" + }, + "version": { + "const": "v1" + } + }, + "required": [ + "name", + "version" + ] + }, + "engineVersion": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "image": { + "type": "string", + "pattern": "^[^\\s]+@sha256:[a-f0-9]{64}$" + }, + "parameters": { + "type": "object", + "additionalProperties": false, + "properties": { + "bucket": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{1,61}[a-z0-9]$" + } + }, + "required": [ + "bucket" + ] + }, + "resources": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + } + }, + "required": [ + "profile" + ] + }, + "storage": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + }, + "size": { + "type": "string", + "pattern": "^[1-9][0-9]*(Mi|Gi|Ti)$" + } + }, + "required": [ + "profile", + "size" + ] + }, + "backup": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + } + }, + "required": [ + "profile" + ] + }, + "restoreFrom": { + "type": "object", + "additionalProperties": false, + "properties": { + "instanceId": { + "type": "string", + "pattern": "^ds-[a-f0-9]{32}$" + }, + "backupId": { + "type": "string", + "pattern": "^op-[a-f0-9]{32}$" + }, + "targetTime": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "instanceId", + "backupId" + ] + } + }, + "required": [ + "templateRef", + "engineVersion", + "image", + "parameters", + "resources", + "storage", + "backup" + ] +} diff --git a/templates/schemas/minio-service.v2.json b/templates/schemas/minio-service.v2.json new file mode 100644 index 0000000..366ba81 --- /dev/null +++ b/templates/schemas/minio-service.v2.json @@ -0,0 +1,78 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/minio-service/v2", + "title": "minio-service@v2", + "description": "Standalone service with one engine container and one retained volume; no HA or operator required.", + "type": "object", + "additionalProperties": false, + "properties": { + "templateRef": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "const": "minio-service" + }, + "version": { + "const": "v2" + } + }, + "required": [ + "name", + "version" + ] + }, + "engineVersion": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "image": { + "type": "string", + "pattern": "^[^\\s]+@sha256:[a-f0-9]{64}$" + }, + "parameters": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "resources": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + } + }, + "required": [ + "profile" + ] + }, + "storage": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + }, + "size": { + "type": "string", + "pattern": "^[1-9][0-9]*(Mi|Gi|Ti)$" + } + }, + "required": [ + "profile", + "size" + ] + } + }, + "required": [ + "templateRef", + "engineVersion", + "image", + "resources", + "storage" + ] +} diff --git a/templates/schemas/postgresql-service.v1.json b/templates/schemas/postgresql-service.v1.json new file mode 100644 index 0000000..7ee8e95 --- /dev/null +++ b/templates/schemas/postgresql-service.v1.json @@ -0,0 +1,123 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/postgresql-service/v1", + "title": "postgresql-service@v1", + "description": "PostgreSQL cluster managed by CloudNativePG; objects are built by the cluster gateway", + "type": "object", + "additionalProperties": false, + "properties": { + "templateRef": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "const": "postgresql-service" + }, + "version": { + "const": "v1" + } + }, + "required": [ + "name", + "version" + ] + }, + "engineVersion": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "image": { + "type": "string", + "pattern": "^[^\\s]+@sha256:[a-f0-9]{64}$" + }, + "parameters": { + "type": "object", + "additionalProperties": false, + "properties": { + "database": { + "type": "string", + "pattern": "^[a-z][a-z0-9_]{0,62}$" + } + }, + "required": [ + "database" + ] + }, + "resources": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + } + }, + "required": [ + "profile" + ] + }, + "storage": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + }, + "size": { + "type": "string", + "pattern": "^[1-9][0-9]*(Mi|Gi|Ti)$" + } + }, + "required": [ + "profile", + "size" + ] + }, + "backup": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + } + }, + "required": [ + "profile" + ] + }, + "restoreFrom": { + "type": "object", + "additionalProperties": false, + "properties": { + "instanceId": { + "type": "string", + "pattern": "^ds-[a-f0-9]{32}$" + }, + "backupId": { + "type": "string", + "pattern": "^op-[a-f0-9]{32}$" + }, + "targetTime": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "instanceId", + "backupId" + ] + } + }, + "required": [ + "templateRef", + "engineVersion", + "image", + "parameters", + "resources", + "storage", + "backup" + ] +} diff --git a/templates/schemas/postgresql-service.v2.json b/templates/schemas/postgresql-service.v2.json new file mode 100644 index 0000000..bdd715f --- /dev/null +++ b/templates/schemas/postgresql-service.v2.json @@ -0,0 +1,87 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/postgresql-service/v2", + "title": "postgresql-service@v2", + "description": "Standalone service with one engine container and one retained volume; no HA or operator required.", + "type": "object", + "additionalProperties": false, + "properties": { + "templateRef": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "const": "postgresql-service" + }, + "version": { + "const": "v2" + } + }, + "required": [ + "name", + "version" + ] + }, + "engineVersion": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "image": { + "type": "string", + "pattern": "^[^\\s]+@sha256:[a-f0-9]{64}$" + }, + "parameters": { + "type": "object", + "additionalProperties": false, + "properties": { + "database": { + "type": "string", + "pattern": "^[a-z][a-z0-9_]{0,62}$" + } + }, + "required": [ + "database" + ] + }, + "resources": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + } + }, + "required": [ + "profile" + ] + }, + "storage": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + }, + "size": { + "type": "string", + "pattern": "^[1-9][0-9]*(Mi|Gi|Ti)$" + } + }, + "required": [ + "profile", + "size" + ] + } + }, + "required": [ + "templateRef", + "engineVersion", + "image", + "resources", + "storage", + "parameters" + ] +} diff --git a/templates/schemas/redis-service.v1.json b/templates/schemas/redis-service.v1.json new file mode 100644 index 0000000..8b96d8f --- /dev/null +++ b/templates/schemas/redis-service.v1.json @@ -0,0 +1,170 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/redis-service/v1", + "title": "redis-service@v1", + "description": "Redis replication with Sentinel; objects are built by the cluster gateway", + "type": "object", + "additionalProperties": false, + "properties": { + "templateRef": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "const": "redis-service" + }, + "version": { + "const": "v1" + } + }, + "required": [ + "name", + "version" + ] + }, + "engineVersion": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "image": { + "type": "string", + "pattern": "^[^\\s]+@sha256:[a-f0-9]{64}$" + }, + "parameters": { + "type": "object", + "additionalProperties": false, + "properties": { + "mode": { + "enum": [ + "cache", + "persistent" + ] + } + }, + "required": [ + "mode" + ] + }, + "resources": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + } + }, + "required": [ + "profile" + ] + }, + "storage": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + }, + "size": { + "type": "string", + "pattern": "^[1-9][0-9]*(Mi|Gi|Ti)$" + } + }, + "required": [ + "profile", + "size" + ] + }, + "backup": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + } + }, + "required": [ + "profile" + ] + }, + "restoreFrom": { + "type": "object", + "additionalProperties": false, + "properties": { + "instanceId": { + "type": "string", + "pattern": "^ds-[a-f0-9]{32}$" + }, + "backupId": { + "type": "string", + "pattern": "^op-[a-f0-9]{32}$" + }, + "targetTime": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "instanceId", + "backupId" + ] + }, + "sentinelImage": { + "type": "string", + "pattern": "^[^\\s]+@sha256:[a-f0-9]{64}$" + } + }, + "required": [ + "templateRef", + "engineVersion", + "image", + "parameters", + "resources", + "sentinelImage" + ], + "allOf": [ + { + "if": { + "properties": { + "parameters": { + "properties": { + "mode": { + "const": "persistent" + } + } + } + } + }, + "then": { + "required": [ + "storage", + "backup" + ] + }, + "else": { + "not": { + "anyOf": [ + { + "required": [ + "storage" + ] + }, + { + "required": [ + "backup" + ] + }, + { + "required": [ + "restoreFrom" + ] + } + ] + } + } + } + ] +} diff --git a/templates/schemas/redis-service.v2.json b/templates/schemas/redis-service.v2.json new file mode 100644 index 0000000..441f020 --- /dev/null +++ b/templates/schemas/redis-service.v2.json @@ -0,0 +1,78 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://platform.example/templates/redis-service/v2", + "title": "redis-service@v2", + "description": "Standalone service with one engine container and one retained volume; no HA or operator required.", + "type": "object", + "additionalProperties": false, + "properties": { + "templateRef": { + "type": "object", + "additionalProperties": false, + "properties": { + "name": { + "const": "redis-service" + }, + "version": { + "const": "v2" + } + }, + "required": [ + "name", + "version" + ] + }, + "engineVersion": { + "type": "string", + "minLength": 1, + "maxLength": 64 + }, + "image": { + "type": "string", + "pattern": "^[^\\s]+@sha256:[a-f0-9]{64}$" + }, + "parameters": { + "type": "object", + "additionalProperties": false, + "properties": {} + }, + "resources": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + } + }, + "required": [ + "profile" + ] + }, + "storage": { + "type": "object", + "additionalProperties": false, + "properties": { + "profile": { + "type": "string", + "pattern": "^[a-z][a-z0-9-]{0,62}$" + }, + "size": { + "type": "string", + "pattern": "^[1-9][0-9]*(Mi|Gi|Ti)$" + } + }, + "required": [ + "profile", + "size" + ] + } + }, + "required": [ + "templateRef", + "engineVersion", + "image", + "resources", + "storage" + ] +}