Skip to content

Commit

Permalink
feat: update version, make api pods scalable
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Dec 6, 2024
1 parent 9eb9b29 commit 400b688
Show file tree
Hide file tree
Showing 8 changed files with 175 additions and 9 deletions.
4 changes: 2 additions & 2 deletions charts/trustify/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ maintainers:
email: jreimann@redhat.com

type: application
version: 0.1.0-alpha.29
appVersion: "0.1.0-alpha.26"
version: 0.1.0-alpha.30
appVersion: "0.1.0-alpha.28"
icon: https://raw.githubusercontent.com/trustification/trustification/main/docs/branding/svg/trustification_icon_default.svg
home: https://trustification.io
4 changes: 3 additions & 1 deletion charts/trustify/templates/helpers/_deployment.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ Arguments (dict):
serviceAccountName: {{ . | quote }}
{{- end }}

{{- with .module.affinity }}
affinity:
{{- with .module.affinity }}
{{- . | toYaml | nindent 2 }}
{{- else }}
{{- include "trustification.storage.defaultPodAffinity" . | nindent 2 }}
{{- end }}

{{- end }}
Expand Down
20 changes: 20 additions & 0 deletions charts/trustify/templates/helpers/_storage.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,23 @@ Arguments (dict):
claimName: {{ include "trustification.common.name" ( set (deepCopy .) "name" "storage" ) }}
{{- end }}
{{- end }}

{{/*
Default pod affinity when using the filesystem storage.
Arguments (dict):
* root - .
* module - module object
*/}}
{{- define "trustification.storage.defaultPodAffinity" }}
{{ $storage := .module.storage | default .root.Values.storage }}
{{- if eq $storage.type "filesystem" }}
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- topologyKey: "kubernetes.io/hostname"
labelSelector:
matchLabels:
{{/* we need to select the "server" pod and align with its host */}}
{{- include "trustification.common.selectorLabels" ( merge (deepCopy .) (dict "name" "server" "component" "server") ) | nindent 10 }}
{{- end }}
{{- end }}
73 changes: 73 additions & 0 deletions charts/trustify/templates/services/importer/030-StatefulSet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{{- if .Values.modules.importer.enabled }}
{{- $mod := dict "root" . "name" "importer" "component" "importer" "module" .Values.modules.importer -}}
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "trustification.common.name" $mod }}
labels:
{{- include "trustification.common.labels" $mod | nindent 4 }}
annotations:
{{- include "trustification.application.annotations" $mod | nindent 4 }}

spec:
replicas: 1
selector:
matchLabels:
{{- include "trustification.common.selectorLabels" $mod | nindent 6 }}
template:
metadata:
labels:
{{- include "trustification.common.selectorLabels" $mod | nindent 8 }}
{{- include "trustification.application.podLabels" $mod | nindent 8 }}

spec:
{{- include "trustification.application.pod" $mod | nindent 6 }}

containers:
- name: service
{{- include "trustification.common.defaultImage" $mod | nindent 10 }}
{{- include "trustification.application.container" $mod | nindent 10 }}
{{- include "trustification.application.infrastructure.probes" $mod | nindent 10 }}

command: [ "/usr/local/bin/trustd" ]
args:
- importer
- --working-dir
- "/data/workdir"

env:

- name: NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace

{{- include "trustification.application.rust.envVars" $mod | nindent 12 }}
{{- include "trustification.application.infrastructure.envVars" $mod | nindent 12 }}
{{- include "trustification.postgres.envVars" (dict "root" . "database" .Values.database) | nindent 12 }}
{{- include "trustification.storage.envVars" $mod | nindent 12 }}

ports:
{{- include "trustification.application.infrastructure.podPorts" $mod | nindent 12 }}

volumeMounts:
- name: workdir
mountPath: /data/workdir
{{- include "trustification.storage.volumeMount" $mod | nindent 12 }}
{{- include "trustification.application.extraVolumeMounts" $mod | nindent 12 }}

volumes:
{{- include "trustification.storage.volume" $mod | nindent 8 }}
{{- include "trustification.application.extraVolumes" $mod | nindent 8 }}

volumeClaimTemplates:
- metadata:
name: workdir
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ $mod.module.workingDirectory.size | quote }}

{{ end }}
6 changes: 0 additions & 6 deletions charts/trustify/templates/services/server/030-Deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ spec:
- api
- --auth-configuration
- "/etc/config/auth.yaml"
- --working-dir
- "/data/workdir"

env:

Expand Down Expand Up @@ -85,16 +83,12 @@ spec:
protocol: TCP

volumeMounts:
- name: workdir
mountPath: /data/workdir
{{- include "trustification.application.httpServerVolumesMounts" $mod | nindent 12 }}
{{- include "trustification.authenticator.volumeMount" $mod | nindent 12 }}
{{- include "trustification.storage.volumeMount" $mod | nindent 12 }}
{{- include "trustification.application.extraVolumeMounts" $mod | nindent 12 }}

volumes:
- name: workdir
emptyDir: {}
{{- include "trustification.application.httpServerVolumes" $mod | nindent 8 }}
{{- include "trustification.authenticator.volume" $mod | nindent 8 }}
{{- include "trustification.storage.volume" $mod | nindent 8 }}
Expand Down
45 changes: 45 additions & 0 deletions charts/trustify/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,51 @@
}
]
},
"importer": {
"description": "The main server process.\n",
"allOf": [
{
"$ref": "#/definitions/Feature"
},
{
"$ref": "#/definitions/Image"
},
{
"$ref": "#/definitions/Application"
},
{
"$ref": "#/definitions/RustApplication"
},
{
"$ref": "#/definitions/Infrastructure"
},
{
"$ref": "#/definitions/Metrics"
},
{
"$ref": "#/definitions/Tracing"
},
{
"$ref": "#/definitions/Postgres"
},
{
"type": "object",
"properties": {
"workingDirectory": {
"type": "object",
"required": [
"size"
],
"properties": {
"size": {
"$ref": "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.29.0/_definitions.json#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity"
}
}
}
}
}
]
},
"createDatabase": {
"description": "Job to create a database in a PostgreSQL instance\n",
"allOf": [
Expand Down
22 changes: 22 additions & 0 deletions charts/trustify/values.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,28 @@ properties:
uploadLimit:
$ref: "#/definitions/ByteSize"

importer:
description: |
The main server process.
allOf:
- $ref: "#/definitions/Feature"
- $ref: "#/definitions/Image"
- $ref: "#/definitions/Application"
- $ref: "#/definitions/RustApplication"
- $ref: "#/definitions/Infrastructure"
- $ref: "#/definitions/Metrics"
- $ref: "#/definitions/Tracing"
- $ref: "#/definitions/Postgres"
- type: object
properties:
workingDirectory:
type: object
required:
- size
properties:
size:
$ref: "https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/v1.29.0/_definitions.json#/definitions/io.k8s.apimachinery.pkg.api.resource.Quantity"

createDatabase:
description: |
Job to create a database in a PostgreSQL instance
Expand Down
10 changes: 10 additions & 0 deletions charts/trustify/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ modules:
metrics: {}
rust: {}

importer:
enabled: true
image: {}
infrastructure: {}
tracing: {}
metrics: {}
rust: {}
workingDirectory:
size: 32Gi

createDatabase:
enabled: false
image:
Expand Down

0 comments on commit 400b688

Please sign in to comment.