From 352c8c661548b1738bf3474e92f05d0dc3796ed9 Mon Sep 17 00:00:00 2001 From: Stephan Meijer Date: Mon, 24 Nov 2025 12:19:47 +0100 Subject: [PATCH] wip --- compose.yml | 2 +- src/helm/impress/templates/_helpers.tpl | 8 + .../impress/templates/docspec_deployment.yaml | 156 ++++++++++++++++++ src/helm/impress/templates/docspec_svc.yaml | 21 +++ .../templates/ingress_docspec_api.yaml | 67 ++++++++ src/helm/impress/values.yaml | 106 ++++++++++++ 6 files changed, 359 insertions(+), 1 deletion(-) create mode 100644 src/helm/impress/templates/docspec_deployment.yaml create mode 100644 src/helm/impress/templates/docspec_svc.yaml create mode 100644 src/helm/impress/templates/ingress_docspec_api.yaml diff --git a/compose.yml b/compose.yml index 55e2a8a8..87e34dcf 100644 --- a/compose.yml +++ b/compose.yml @@ -219,6 +219,6 @@ services: restart: true docspec: - image: ghcr.io/docspecio/api:2.0.0 + image: ghcr.io/docspecio/api:2.0.2 ports: - "4000:4000" \ No newline at end of file diff --git a/src/helm/impress/templates/_helpers.tpl b/src/helm/impress/templates/_helpers.tpl index 63a9f4b3..b1e6febf 100644 --- a/src/helm/impress/templates/_helpers.tpl +++ b/src/helm/impress/templates/_helpers.tpl @@ -166,6 +166,14 @@ Requires top level scope {{ include "impress.fullname" . }}-y-provider {{- end }} +{{/* +Full name for the docSpecApi + +Requires top level scope +*/}} +{{- define "impress.docSpecApi.fullname" -}} +{{ include "impress.fullname" . }}-docspec-api +{{- end }} {{/* Full name for the Celery Worker diff --git a/src/helm/impress/templates/docspec_deployment.yaml b/src/helm/impress/templates/docspec_deployment.yaml new file mode 100644 index 00000000..28a4c27a --- /dev/null +++ b/src/helm/impress/templates/docspec_deployment.yaml @@ -0,0 +1,156 @@ +{{- $envVars := include "impress.common.env" (list . .Values.docSpecApi) -}} +{{- $fullName := include "impress.docSpecApi.fullname" . -}} +{{- $component := "docspec" -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace | quote }} + annotations: + {{- with .Values.backend.dpAnnotations }} + {{- toYaml . | nindent 4 }} + {{- end }} + labels: + {{- include "impress.common.labels" (list . $component) | nindent 4 }} +spec: + replicas: {{ .Values.docSpecApi.replicas }} + selector: + matchLabels: + {{- include "impress.common.selectorLabels" (list . $component) | nindent 6 }} + template: + metadata: + annotations: + {{- with .Values.docSpecApi.podAnnotations }} + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "impress.common.selectorLabels" (list . $component) | nindent 8 }} + spec: + {{- if $.Values.image.credentials }} + imagePullSecrets: + - name: {{ include "impress.secret.dockerconfigjson.name" (dict "fullname" (include "impress.fullname" .) "imageCredentials" $.Values.image.credentials) }} + {{- end}} + {{- if .Values.docSpecApi.serviceAccountName }} + serviceAccountName: {{ .Values.docSpecApi.serviceAccountName }} + {{- end }} + shareProcessNamespace: {{ .Values.docSpecApi.shareProcessNamespace }} + containers: + {{- with .Values.docSpecApi.sidecars }} + {{- toYaml . | nindent 8 }} + {{- end }} + - name: {{ .Chart.Name }} + image: "{{ (.Values.docSpecApi.image | default dict).repository | default .Values.image.repository }}:{{ (.Values.docSpecApi.image | default dict).tag | default .Values.image.tag }}" + imagePullPolicy: {{ (.Values.docSpecApi.image | default dict).pullPolicy | default .Values.image.pullPolicy }} + {{- with .Values.yPrdocspecovider.command }} + command: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.docSpecApi.args }} + args: + {{- toYaml . | nindent 12 }} + {{- end }} + env: + {{- if $envVars}} + {{- $envVars | indent 12 }} + {{- end }} + {{- with .Values.docSpecApi.securityContext }} + securityContext: + {{- toYaml . | nindent 12 }} + {{- end }} + ports: + - name: http + containerPort: {{ .Values.docSpecApi.service.targetPort }} + protocol: TCP + {{- if .Values.docSpecApi.probes.liveness }} + livenessProbe: + {{- include "impress.probes.abstract" (merge .Values.docSpecApi.probes.liveness (dict "targetPort" .Values.docSpecApi.service.targetPort )) | nindent 12 }} + {{- end }} + {{- if .Values.docSpecApi.probes.readiness }} + readinessProbe: + {{- include "impress.probes.abstract" (merge .Values.docSpecApi.probes.readiness (dict "targetPort" .Values.docSpecApi.service.targetPort )) | nindent 12 }} + {{- end }} + {{- if .Values.docSpecApi.probes.startup }} + startupProbe: + {{- include "impress.probes.abstract" (merge .Values.docSpecApi.probes.startup (dict "targetPort" .Values.docSpecApi.service.targetPort )) | nindent 12 }} + {{- end }} + {{- with .Values.docSpecApi.resources }} + resources: + {{- toYaml . | nindent 12 }} + {{- end }} + volumeMounts: + {{- range $index, $value := .Values.mountFiles }} + - name: "files-{{ $index }}" + mountPath: {{ $value.path }} + subPath: content + {{- end }} + {{- range $name, $volume := .Values.docSpecApi.persistence }} + - name: "{{ $name }}" + mountPath: "{{ $volume.mountPath }}" + {{- end }} + {{- range .Values.docSpecApi.extraVolumeMounts }} + - name: {{ .name }} + mountPath: {{ .mountPath }} + subPath: {{ .subPath | default "" }} + readOnly: {{ .readOnly }} + {{- end }} + {{- with .Values.docSpecApi.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.docSpecApi.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.docSpecApi.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} + volumes: + {{- range $index, $value := .Values.mountFiles }} + - name: "files-{{ $index }}" + configMap: + name: "{{ include "impress.fullname" $ }}-files-{{ $index }}" + {{- end }} + {{- range $name, $volume := .Values.docSpecApi.persistence }} + - name: "{{ $name }}" + {{- if eq $volume.type "emptyDir" }} + emptyDir: {} + {{- else }} + persistentVolumeClaim: + claimName: "{{ $fullName }}-{{ $name }}" + {{- end }} + {{- end }} + {{- range .Values.docSpecApi.extraVolumes }} + - name: {{ .name }} + {{- if .existingClaim }} + persistentVolumeClaim: + claimName: {{ .existingClaim }} + {{- else if .hostPath }} + hostPath: + {{ toYaml .hostPath | nindent 12 }} + {{- else if .csi }} + csi: + {{- toYaml .csi | nindent 12 }} + {{- else if .configMap }} + configMap: + {{- toYaml .configMap | nindent 12 }} + {{- else if .emptyDir }} + emptyDir: + {{- toYaml .emptyDir | nindent 12 }} + {{- else }} + emptyDir: {} + {{- end }} + {{- end }} +--- +{{ if .Values.docSpecApi.pdb.enabled }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace | quote }} +spec: + maxUnavailable: 1 + selector: + matchLabels: + {{- include "impress.common.selectorLabels" (list . $component) | nindent 6 }} +{{ end }} diff --git a/src/helm/impress/templates/docspec_svc.yaml b/src/helm/impress/templates/docspec_svc.yaml new file mode 100644 index 00000000..605e0776 --- /dev/null +++ b/src/helm/impress/templates/docspec_svc.yaml @@ -0,0 +1,21 @@ +{{- $envVars := include "impress.common.env" (list . .Values.yProvider) -}} +{{- $fullName := include "impress.docspec.fullname" . -}} +{{- $component := "docspec" -}} +apiVersion: v1 +kind: Service +metadata: + name: {{ $fullName }} + namespace: {{ .Release.Namespace | quote }} + labels: + {{- include "impress.common.labels" (list . $component) | nindent 4 }} + annotations: + {{- toYaml $.Values.docspec.service.annotations | nindent 4 }} +spec: + type: {{ .Values.docspec.service.type }} + ports: + - port: {{ .Values.docspec.service.port }} + targetPort: {{ .Values.docspec.service.targetPort }} + protocol: TCP + name: http + selector: + {{- include "impress.common.selectorLabels" (list . $component) | nindent 4 }} diff --git a/src/helm/impress/templates/ingress_docspec_api.yaml b/src/helm/impress/templates/ingress_docspec_api.yaml new file mode 100644 index 00000000..e84d350e --- /dev/null +++ b/src/helm/impress/templates/ingress_docspec_api.yaml @@ -0,0 +1,67 @@ +{{- if .Values.ingressDocSpecApi.enabled -}} +{{- $fullName := include "impress.fullname" . -}} +{{- if and .Values.ingressDocSpecApi.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingressDocSpecApi.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingressDocSpecApi.annotations "kubernetes.io/ingress.class" .Values.ingressCollaborationApi.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }}-collaboration-api + namespace: {{ .Release.Namespace | quote }} + labels: + {{- include "impress.labels" . | nindent 4 }} + {{- with .Values.ingressDocSpecApi.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingressDocSpecApi.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingressDocSpecApi.className }} + {{- end }} + {{- if .Values.ingressDocSpecApi.tls.enabled }} + tls: + {{- if .Values.ingressDocSpecApi.host }} + - secretName: {{ .Values.ingressDocSpecApi.tls.secretName | default (printf "%s-tls" $fullName) | quote }} + hosts: + - {{ .Values.ingressDocSpecApi.host | quote }} + {{- end }} + {{- range .Values.ingressDocSpecApi.tls.additional }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- if .Values.ingressDocSpecApi.host }} + - host: {{ .Values.ingressDocSpecApi.host | quote }} + http: + paths: + - path: {{ .Values.ingressDocSpecApi.path | quote }} + {{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }} + pathType: ImplementationSpecific + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ include "impress.docspec.fullname" . }} + port: + number: {{ .Values.docspec.service.port }} + {{- else }} + serviceName: {{ include "impress.docspec.fullname" . }} + servicePort: {{ .Values.docspec.service.port }} + {{- end }} + {{- with .Values.ingressDocSpecApi.customBackends }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} +{{- end }} diff --git a/src/helm/impress/values.yaml b/src/helm/impress/values.yaml index f063e478..3bc32342 100644 --- a/src/helm/impress/values.yaml +++ b/src/helm/impress/values.yaml @@ -661,3 +661,109 @@ yProvider: ## @param yProvider.serviceAccountName Optional service account name to use for yProvider pods serviceAccountName: null + + +## @section docSpecApi + +docSpecApi: + ## @param docSpecApi.image.repository Repository to use to pull impress's docSpecApi container image + ## @param docSpecApi.image.tag impress's docSpecApi container tag + ## @param docSpecApi.image.pullPolicy docSpecApi container image pull policy + image: + repository: ghcr.io/docspecio/api + pullPolicy: IfNotPresent + tag: "latest" + + ## @param docSpecApi.command Override the docSpecApi container command + command: [] + + ## @param docSpecApi.args Override the docSpecApi container args + args: [] + + ## @param docSpecApi.replicas Amount of docSpecApi replicas + replicas: 3 + + ## @param docSpecApi.shareProcessNamespace Enable share process namedocSpecApi between containers + shareProcessNamespace: false + + ## @param docSpecApi.sidecars Add sidecars containers to docSpecApi deployment + sidecars: [] + + ## @param docSpecApi.securityContext Configure docSpecApi Pod security context + securityContext: null + + ## @param docSpecApi.envVars Configure docSpecApi container environment variables + ## @extra docSpecApi.envVars.BY_VALUE Example environment variable by setting value directly + ## @extra docSpecApi.envVars.FROM_CONFIGMAP.configMapKeyRef.name Name of a ConfigMap when configuring env vars from a ConfigMap + ## @extra docSpecApi.envVars.FROM_CONFIGMAP.configMapKeyRef.key Key within a ConfigMap when configuring env vars from a ConfigMap + ## @extra docSpecApi.envVars.FROM_SECRET.secretKeyRef.name Name of a Secret when configuring env vars from a Secret + ## @extra docSpecApi.envVars.FROM_SECRET.secretKeyRef.key Key within a Secret when configuring env vars from a Secret + ## @skip docSpecApi.envVars + envVars: + <<: *commonEnvVars + + ## @param docSpecApi.podAnnotations Annotations to add to the docSpecApi Pod + podAnnotations: {} + + ## @param docSpecApi.dpAnnotations Annotations to add to the docSpecApi Deployment + dpAnnotations: {} + + ## @param docSpecApi.service.type docSpecApi Service type + ## @param docSpecApi.service.port docSpecApi Service listening port + ## @param docSpecApi.service.targetPort docSpecApi container listening port + ## @param docSpecApi.service.annotations Annotations to add to the docSpecApi Service + service: + type: ClusterIP + port: 443 + targetPort: 4000 + annotations: {} + + ## @extra docSpecApi.probes.liveness.path Configure path for docSpecApi HTTP liveness probe + ## @extra docSpecApi.probes.liveness.targetPort Configure port for docSpecApi HTTP liveness probe + ## @extra docSpecApi.probes.liveness.initialDelaySeconds Configure initial delay for docSpecApi liveness probe + ## @extra docSpecApi.probes.liveness.initialDelaySeconds Configure timeout for docSpecApi liveness probe + ## @extra docSpecApi.probes.startup.path Configure path for docSpecApi HTTP startup probe + ## @extra docSpecApi.probes.startup.targetPort Configure port for docSpecApi HTTP startup probe + ## @extra docSpecApi.probes.startup.initialDelaySeconds Configure initial delay for docSpecApi startup probe + ## @extra docSpecApi.probes.startup.initialDelaySeconds Configure timeout for docSpecApi startup probe + ## @extra docSpecApi.probes.readiness.path Configure path for docSpecApi HTTP readiness probe + ## @extra docSpecApi.probes.readiness.targetPort Configure port for docSpecApi HTTP readiness probe + ## @extra docSpecApi.probes.readiness.initialDelaySeconds Configure initial delay for docSpecApi readiness probe + ## @extra docSpecApi.probes.readiness.initialDelaySeconds Configure timeout for docSpecApi readiness probe + probes: + liveness: + ## @param docSpecApi.probes.liveness.path + ## @param docSpecApi.probes.liveness.initialDelaySeconds + path: /health + initialDelaySeconds: 10 + + ## @param docSpecApi.resources Resource requirements for the docSpecApi container + resources: {} + + ## @param docSpecApi.nodeSelector Node selector for the docSpecApi Pod + nodeSelector: {} + + ## @param docSpecApi.tolerations Tolerations for the docSpecApi Pod + tolerations: [] + + ## @param docSpecApi.affinity Affinity for the docSpecApi Pod + affinity: {} + + ## @param docSpecApi.persistence Additional volumes to create and mount on the docSpecApi. Used for debugging purposes + ## @extra docSpecApi.persistence.volume-name.size Size of the additional volume + ## @extra docSpecApi.persistence.volume-name.type Type of the additional volume, persistentVolumeClaim or emptyDir + ## @extra docSpecApi.persistence.volume-name.mountPath Path where the volume should be mounted to + persistence: {} + + ## @param docSpecApi.extraVolumeMounts Additional volumes to mount on the docSpecApi. + extraVolumeMounts: [] + + ## @param docSpecApi.extraVolumes Additional volumes to mount on the docSpecApi. + extraVolumes: [] + + ## @param docSpecApi.pdb.enabled Enable pdb on docSpecApi + pdb: + enabled: true + + ## @param docSpecApi.serviceAccountName Optional service account name to use for docSpecApi pods + serviceAccountName: null