Skip to content

Commit

Permalink
Merge pull request #23 from regulaforensics/faceapi-release
Browse files Browse the repository at this point in the history
refactor. update config to config.yaml
  • Loading branch information
AndreiPaulau authored Jan 4, 2024
2 parents 8aad69f + d020a7c commit 62e13ce
Show file tree
Hide file tree
Showing 27 changed files with 902 additions and 597 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
type: string
helm_version:
description: version of the helm binary
default: v3.11.2
default: v3.13.3
required: false
type: string

Expand All @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -31,7 +31,7 @@ jobs:
with:
version: ${{ inputs.helm_version }}

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.9'
check-latest: true
Expand All @@ -51,7 +51,7 @@ jobs:
run: ct lint --config "${CT_CONFIGFILE}" --validate-maintainers=false

- name: Create kind cluster
uses: helm/kind-action@v1.5.0
uses: helm/kind-action@v1.8.0
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -23,7 +23,7 @@ jobs:
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.11.2
version: v3.13.3

- name: Add dependency chart repos
run: |
Expand All @@ -32,6 +32,6 @@ jobs:
helm repo add milvus https://zilliztech.github.io/milvus-helm
- name: Run chart-releaser
uses: helm/chart-releaser-action@v1.5.0
uses: helm/chart-releaser-action@v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
4 changes: 2 additions & 2 deletions .github/workflows/sync-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
sync-readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: |
cp -f README.md ${{ runner.temp }}/README.md
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
ref: gh-pages
- run: |
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.DS_Store
.vscode
charts/**/test-values.yaml
charts/**/test-*.yaml
8 changes: 4 additions & 4 deletions charts/faceapi/Chart.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 11.9.13
version: 13.2.27
- name: milvus
repository: https://zilliztech.github.io/milvus-helm/
version: 4.1.9
digest: sha256:3f60a38bb689d2e6ec51b5eb7d6a378e5e1791803afad8f9453cfab4da06aca3
generated: "2023-11-14T18:29:33.165182658+03:00"
version: 4.1.11
digest: sha256:c955b7092dfccdfbfe123e676ec89cfb13f9de0517255c6fab96c65632389269
generated: "2024-01-03T16:15:15.981736242+03:00"
6 changes: 3 additions & 3 deletions charts/faceapi/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apiVersion: v2
name: faceapi
home: https://faceapi.regulaforensics.com/
version: 0.7.3
version: 1.0.0
appVersion: nightly
description: Face Recognition Service. On-premise and cloud integration
icon: https://secure.gravatar.com/avatar/71a5efd69d82e444129ad18f51224bbb.jpg
Expand All @@ -14,11 +14,11 @@ keywords:
- regulaforensics
dependencies:
- name: postgresql
version: 11.9.13
version: 13.2.27
repository: "https://charts.bitnami.com/bitnami"
condition: postgresql.enabled
- name: milvus
version: 4.1.9
version: 4.1.11
repository: "https://zilliztech.github.io/milvus-helm/"
condition: milvus.enabled
maintainers:
Expand Down
292 changes: 205 additions & 87 deletions charts/faceapi/README.md

Large diffs are not rendered by default.

Binary file added charts/faceapi/charts/milvus-4.1.11.tgz
Binary file not shown.
Binary file removed charts/faceapi/charts/milvus-4.1.9.tgz
Binary file not shown.
Binary file removed charts/faceapi/charts/postgresql-11.9.13.tgz
Binary file not shown.
Binary file added charts/faceapi/charts/postgresql-13.2.27.tgz
Binary file not shown.
133 changes: 72 additions & 61 deletions charts/faceapi/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,29 @@
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}


{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "faceapi.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end }}
{{- end }}
{{- end }}

{{/* Create chart name and version as used by the chart label. */}}
{{- define "faceapi.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}


{{/* Common labels */}}
{{- define "faceapi.labels" -}}
helm.sh/chart: {{ include "faceapi.chart" . }}
Expand All @@ -39,91 +36,105 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}


{{/* matchLabels */}}
{{- define "faceapi.matchLabels" -}}
app.kubernetes.io/name: {{ include "faceapi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}


{{/* Selector labels */}}
{{- define "faceapi.selectorLabels" -}}
app.kubernetes.io/name: {{ include "faceapi.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}


{{/* Version name */}}
{{- define "version" -}}
{{- if .Values.version | default "cpu" | lower | regexMatch "^(cpu|gpu)$" -}}
{{ .Values.version | default "cpu" | lower }}
{{- else}}
{{- else }}
{{ required (printf "Incorrect 'version': %s. Possible value: cpu or gpu" .Values.version) nil }}
{{- end -}}
{{- end -}}


{{/* faceapi license secret name */}}
{{- define "faceapi.license.secret" -}}
{{ default (printf "%s-license" .Release.Name) .Values.licenseSecretName }}
{{- end }}


{{/* faceapi certificates secret name */}}
{{- define "faceapi.certificate.secret" -}}
{{ default (printf "%s-certificates" .Release.Name) .Values.https.certificatesSecretName }}
{{- end }}


{{/* Config map name */}}
{{- define "faceapi.config.name" -}}
{{ (printf "%s-faceapi-config" .Release.Name) }}
{{- end }}

{{/* Faceapi license secret name */}}
{{- define "faceapi.license.secret" -}}
{{ default (printf "%s-license" .Release.Name) .Values.licenseSecretName }}
{{- end }}

{{/* User defined faceapi environment variables */}}
{{- define "faceapi.envs" -}}
{{- range $i, $config := .Values.env }}
- name: {{ $config.name }}
value: {{ $config.value | quote }}
{{- end }}
{{/* Faceapi certificates secret name */}}
{{- define "faceapi.certificates.secret" -}}
{{ default (printf "%s-certificates" .Release.Name) .Values.ssl.certificatesSecretName }}
{{- end }}

{{/* Faceapi AWS Credentials secret name */}}
{{- define "faceapi.aws.credentials.secret" -}}
{{- if and (eq .Values.storage.type "s3") .Values.storage.s3.awsCredentialsSecretName -}}
{{ default (printf "%s-aws-credentials" .Release.Name) .Values.storage.s3.awsCredentialsSecretName }}
{{- end }}
{{- end }}

{{/* Minio/S3 Storage endpoint */}}
{{- define "faceapi.storage.endpoint" -}}
{{ default (printf "http://%s-minio:9000" .Release.Name) .Values.storage.endpoint }}
{{/* Faceapi GCS Credentials secret name */}}
{{- define "faceapi.gcs.credentials.secret" -}}
{{- if and (eq .Values.storage.type "gcs") .Values.storage.gcs.gcsKeyJsonSecretName -}}
{{ default (printf "%s-gcs-credentials" .Release.Name) .Values.storage.gcs.gcsKeyJsonSecretName }}
{{- end }}
{{- end }}

{{/* Faceapi Azure Storage Connection String secret name */}}
{{- define "faceapi.az.credentials.secret" -}}
{{- if and (eq .Values.storage.type "az") .Values.storage.az.connectionStringSecretName -}}
{{ default (printf "%s-az-credentials" .Release.Name) .Values.storage.az.connectionStringSecretName }}
{{- end }}
{{- end }}

{{/* Milvus host */}}
{{- define "faceapi.identification.milvus_host" -}}
{{ default (printf "%s-milvus" .Release.Name) .Values.identification.milvusHost }}
{{/* Faceapi Database Connection String secret name */}}
{{- define "faceapi.db.credentials.secret" -}}
{{- if .Values.database.connectionStringSecretName -}}
{{ default (printf "%s-db-credentials" .Release.Name) .Values.database.connectionStringSecretName }}
{{- end }}
{{- end }}

{{/* Milvus endpoint */}}
{{- define "faceapi.milvus" -}}
{{ default (printf "%s-milvus:19530" .Release.Name) }}
{{- end }}

{{/* PostgreSQL host */}}
{{- define "faceapi.postgresql" -}}
{{ default (printf "%s-postgresql" .Release.Name) }}
{{- end }}


{{- define "faceapi.postgresql.secret" -}}
{{- if .Values.externalPostgreSQLSecret }}
- name: FACEAPI_SQL_URL
valueFrom:
secretKeyRef:
{{- .Values.externalPostgreSQLSecret | toYaml | nindent 6 }}
{{- end }}
{{/* User defined faceapi environment variables */}}
{{- define "faceapi.envs" -}}
{{- range $i, $config := .Values.env }}
- name: {{ $config.name }}
value: {{ $config.value | quote }}
{{- end }}
{{- end }}

{{/* Faceapi detect-match/results existing volume claim */}}
{{- define "faceapi.detectmatch.results.pvc" -}}
{{- if .Values.detectMatch.results.persistence.existingClaim -}}
{{ .Values.detectMatch.results.persistence.existingClaim }}
{{- else -}}
{{ .Release.Name }}-detectmatch-results
{{- end -}}
{{- end -}}

{{/* Faceapi liveness/sessions existing volume claim */}}
{{- define "faceapi.liveness.sessions.pvc" -}}
{{- if .Values.liveness.sessions.persistence.existingClaim -}}
{{ .Values.liveness.sessions.persistence.existingClaim }}
{{- else -}}
{{ .Release.Name }}-liveness-sessions
{{- end -}}
{{- end -}}

{{/* Face-API logs PVC */}}
{{- define "faceapi.logs.pvc" -}}
{{- if .Values.logs.persistence.existingClaim -}}
{{ .Values.logs.persistence.existingClaim }}
{{/* Faceapi search/persons existing volume claim */}}
{{- define "faceapi.search.persons.pvc" -}}
{{- if .Values.search.persons.persistence.existingClaim -}}
{{ .Values.search.persons.persistence.existingClaim }}
{{- else -}}
{{ .Release.Name }}-logs
{{ .Release.Name }}-search-persons
{{- end -}}
{{- end -}}
{{- end -}}
51 changes: 8 additions & 43 deletions charts/faceapi/templates/check-values.yaml
Original file line number Diff line number Diff line change
@@ -1,50 +1,15 @@
{{/* The purpose of this yaml file is it to check the values file is consistent for some complexe combinations. */}}

{{- /* HTTPS checks */ -}}
{{- if .Values.https.enabled }}
{{- if not .Values.https.certificatesSecretName }}
{{ required "When 'HTTPS' mode is enabled, https.certificatesSecretName value should be set." nil }}
{{- /* SSL checks */ -}}
{{- if .Values.ssl.enabled }}
{{- if not .Values.ssl.certificatesSecretName }}
{{ required "When 'SSL' mode is enabled, ssl.certificatesSecretName value should be set." nil }}
{{- end }}
{{- end }}

{{- /* Identification/Liveness related checks */ -}}
{{- /* Ensure PostgreSQL is enabled Identification or Liveness is enabled as well */ -}}
{{- if or .Values.postgresql.enabled .Values.externalPostgreSQL .Values.externalPostgreSQLSecret }}
{{- if and (not .Values.liveness.enabled) (not .Values.identification.enabled) }}
{{ required "'Identification/Liveness' modules or 'Liveness' module should be enabled before 'postgresql.enabled' OR 'externalPostgreSQL' OR 'externalPostgreSQLSecret' value is set." nil }}
{{- /* Liveness / Search modules checks */ -}}
{{- if or .Values.liveness.enabled .Values.search.enabled }}
{{- if not (or .Values.database.connectionString .Values.database.connectionStringSecretName .Values.postgresql.enabled ) }}
{{ required "When 'Liveness or/and Search' mode(-s) is/are enabled, `database.connectionString` or `database.connectionStringSecretName` or `postgresql.enabled` value should be set." nil }}
{{- end }}
{{- end }}

{{- /* Ensure Identification is enabled if Milvus is enabled */ -}}
{{- if and (not .Values.identification.enabled) .Values.milvus.enabled }}
{{ required "'Identification' module should be enabled before 'milvus.enabled' value is set." nil }}
{{- end }}

{{- /* Ensure Identification related values are properly set */ -}}
{{- if .Values.identification.enabled }}
{{- if not (or .Values.postgresql.enabled .Values.externalPostgreSQL .Values.externalPostgreSQLSecret) }}
{{ required "When 'Identification' module is enabled, 'postgresql.enabled' OR 'externalPostgreSQL' OR 'externalPostgreSQLSecret' value should be set." nil }}
{{- end }}
{{- if and .Values.externalPostgreSQL .Values.externalPostgreSQLSecret }}
{{ required "You must set one of the values externalPostgreSQL OR externalPostgreSQLSecret when using external postgreSQL." nil }}
{{- end }}
{{- if and .Values.postgresql.enabled (or .Values.externalPostgreSQL .Values.externalPostgreSQLSecret) }}
{{ required "You must enable only 'postgresql.enabled' or use externalPostgreSQL/externalPostgreSQLSecret at a time." nil }}
{{- end }}
{{- if (not .Values.milvus.enabled) }}
{{ required "When 'Identification' module is enabled, 'milvus.enabled' value should be set." nil }}
{{- end }}
{{- end }}

{{- /* Ensure Liveness related values are properly set */ -}}
{{- if .Values.liveness.enabled }}
{{- if not (or .Values.postgresql.enabled .Values.externalPostgreSQL .Values.externalPostgreSQLSecret) }}
{{ required "When 'Liveness' module is enabled, 'postgresql.enabled' OR 'externalPostgreSQL' OR 'externalPostgreSQLSecret' value should be set." nil }}
{{- end }}
{{- if and .Values.externalPostgreSQL .Values.externalPostgreSQLSecret }}
{{ required "You must set one of the values externalPostgreSQL OR externalPostgreSQLSecret when using external postgreSQL." nil }}
{{- end }}
{{- if and .Values.postgresql.enabled (or .Values.externalPostgreSQL .Values.externalPostgreSQLSecret) }}
{{ required "You must enable only 'postgresql.enabled' or use externalPostgreSQL/externalPostgreSQLSecret at a time." nil }}
{{- end }}
{{- end }}
Loading

0 comments on commit 62e13ce

Please sign in to comment.