-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sophora-image-ai]: add Sophora Image AI (#59)
* add chart for sophora-image-ai * let's not confuse things * add configmap.yaml checksum annotation
- Loading branch information
Showing
11 changed files
with
372 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
name: sophora-image-ai | ||
description: Sophora Image AI | ||
type: application | ||
version: 1.0.0 | ||
appVersion: 4.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Sophora Image AI | ||
|
||
The [Image AI] module supports the editorial team in creating image variants in image documents. | ||
Instead of manually selecting clips for each image variant, the clips are calculated automatically | ||
using Google Cloud Vision. | ||
|
||
## Secrets | ||
|
||
This chart requires secrets to be created prior to installation. In particular, the credentials for | ||
your Google Cloud Platform project must be stored in a secret. | ||
|
||
To create the credentials secret, have your credentials JSON file ready. You can export this file | ||
in the IAM section in Google Cloud Platform. | ||
|
||
To create the secret, run the following command: | ||
|
||
``` | ||
kubectl create secret generic sophora-image-ai-gcp-credentials \ | ||
--from-literal "credentials.json=$(cat my-project-credentials.json)" | ||
``` | ||
|
||
Replace the path to `my-project-credentials.json` with the path to your actual credentials JSON file. | ||
|
||
After creating the secret, you can proceed to install the chart. | ||
|
||
|
||
|
||
[Image AI]: https://subshell.com/sophora/modules/sophora-image-ai100.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "sophora-image-ai.name" -}} | ||
{{- 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 "sophora-image-ai.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .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 }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "sophora-image-ai.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "sophora-image-ai.labels" -}} | ||
helm.sh/chart: {{ include "sophora-image-ai.chart" . }} | ||
{{ include "sophora-image-ai.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "sophora-image-ai.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "sophora-image-ai.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Renders a value that contains template. | ||
Usage: | ||
{{ include "common.tplvalues.render" ( dict "value" .Values.path.to.the.Value "context" $) }} | ||
*/}} | ||
{{- define "common.tplvalues.render" -}} | ||
{{- if typeIs "string" .value }} | ||
{{- tpl .value .context }} | ||
{{- else }} | ||
{{- tpl (.value | toYaml) .context }} | ||
{{- end }} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "sophora-image-ai.fullname" . }} | ||
labels: | ||
{{- include "sophora-image-ai.labels" . | nindent 4 }} | ||
data: | ||
application.yaml: |- {{ toYaml (required "A valid application.yaml config is required" .Values.sophora.configuration) | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "sophora-image-ai.fullname" . }} | ||
labels: | ||
{{- include "sophora-image-ai.labels" . | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{- include "sophora-image-ai.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
annotations: | ||
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} | ||
{{- with .Values.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "sophora-image-ai.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
containers: | ||
- name: image-ai | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
volumeMounts: | ||
- name: config | ||
mountPath: /config | ||
readOnly: true | ||
- name: gcp-credentials | ||
mountPath: /gcp-credentials | ||
readOnly: true | ||
ports: | ||
- name: http | ||
protocol: TCP | ||
containerPort: 8080 | ||
env: | ||
- name: JDK_JAVA_OPTIONS | ||
value: {{ .Values.javaOptions }} | ||
- name: SOPHORA_CLIENT_SERVERCONNECTION_USERNAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ required "A valid secret name must be provided in .Values.sophora.authentication.secret.name" .Values.sophora.authentication.secret.name | quote }} | ||
key: {{ .Values.sophora.authentication.secret.usernameKey | quote }} | ||
- name: SOPHORA_CLIENT_SERVERCONNECTION_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ required "A valid secret name must be provided in .Values.sophora.authentication.secret.name" .Values.sophora.authentication.secret.name | quote }} | ||
key: {{ .Values.sophora.authentication.secret.passwordKey | quote }} | ||
{{- if .Values.imageAI.extraEnv }} | ||
{{- toYaml .Values.imageAI.extraEnv | nindent 12 }} | ||
{{- end }} | ||
startupProbe: | ||
httpGet: | ||
port: http | ||
path: /actuator/health/liveness | ||
periodSeconds: 1 | ||
failureThreshold: 30 | ||
livenessProbe: | ||
httpGet: | ||
port: http | ||
path: /actuator/health/liveness | ||
readinessProbe: | ||
httpGet: | ||
port: http | ||
path: /actuator/health/readiness | ||
volumes: | ||
- name: config | ||
configMap: | ||
name: {{ include "sophora-image-ai.fullname" . }} | ||
- name: gcp-credentials | ||
secret: | ||
secretName: sophora-image-ai-gcp-credentials |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{{- range .Values.extraDeploy }} | ||
--- | ||
{{ include "common.tplvalues.render" (dict "value" . "context" $) }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{{- if .Values.ingress.enabled -}} | ||
{{- $fullName := include "sophora-image-ai.fullname" . -}} | ||
{{- $svcPort := .Values.service.port -}} | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ $fullName }} | ||
labels: | ||
{{- include "sophora-image-ai.labels" . | nindent 4 }} | ||
{{- with .Values.ingress.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
{{- if .Values.ingress.ingressClassName }} | ||
ingressClassName: {{ .Values.ingress.ingressClassName }} | ||
{{- end -}} | ||
{{- if .Values.ingress.tls }} | ||
tls: | ||
{{- range .Values.ingress.tls }} | ||
- hosts: | ||
{{- range .hosts }} | ||
- {{ . | quote }} | ||
{{- end }} | ||
secretName: {{ .secretName }} | ||
{{- end }} | ||
{{- end }} | ||
rules: | ||
{{- range .Values.ingress.hosts }} | ||
- host: {{ .host | quote }} | ||
http: | ||
paths: | ||
- path: {{ .path }} | ||
pathType: {{ default "ImplementationSpecific" .pathType }} | ||
backend: | ||
service: | ||
name: {{ $fullName }} | ||
port: | ||
number: {{ $svcPort }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "sophora-image-ai.fullname" . }} | ||
labels: | ||
{{- include "sophora-image-ai.labels" . | nindent 4 }} | ||
{{- with .Values.service.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
selector: | ||
{{- include "sophora-image-ai.selectorLabels" . | nindent 4 }} | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- protocol: TCP | ||
targetPort: http | ||
port: {{ .Values.service.port }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
nameOverride: image-ai | ||
|
||
image: | ||
repository: docker.subshell.com/sophora/imageai | ||
pullPolicy: IfNotPresent | ||
# Overrides the image tag whose default is the chart appVersion. | ||
tag: latest | ||
|
||
imagePullSecrets: | ||
- name: docker-subshell | ||
|
||
sophora: | ||
authentication: | ||
secret: | ||
name: sophora-secret | ||
|
||
configuration: | ||
sophora: | ||
client: | ||
server-connection: | ||
urls: | ||
- https://sophora-server.example.com:1196 | ||
username: # in secret | ||
password: # in secret | ||
|
||
spring: | ||
cloud: | ||
gcp: | ||
# GCP project ID | ||
project-id: my-project | ||
|
||
credentials: | ||
# path to GCP credentials file - do not change | ||
location: file:/gcp-credentials/credentials.json | ||
|
||
imageAI: | ||
extraEnv: | ||
|
||
podAnnotations: {} | ||
|
||
ingress: | ||
enabled: true | ||
ingressClassName: nginx | ||
annotations: {} | ||
hosts: | ||
tls: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
image: | ||
repository: docker.subshell.com/sophora/imageai | ||
pullPolicy: IfNotPresent | ||
# Overrides the image tag whose default is the chart appVersion. | ||
tag: "4.0.0" | ||
|
||
imagePullSecrets: [] | ||
|
||
javaOptions: -XX:+ExitOnOutOfMemoryError -XX:+PerfDisableSharedMem | ||
|
||
sophora: | ||
authentication: | ||
secret: | ||
name: "" | ||
usernameKey: username | ||
passwordKey: password | ||
|
||
# Represents the application.yaml of Sophora Image AI | ||
configuration: | ||
# Settings for the Sophora server connection. | ||
sophora: | ||
client: | ||
server-connection: | ||
urls: [] | ||
username: # in secret | ||
password: # in secret | ||
|
||
spring: | ||
cloud: | ||
gcp: | ||
# GCP project ID | ||
project-id: my-project | ||
|
||
credentials: | ||
# path to GCP credentials file - do not change | ||
location: file:/gcp-credentials/credentials.json | ||
|
||
imageAI: | ||
extraEnv: | ||
|
||
service: | ||
type: ClusterIP | ||
port: 8080 | ||
annotations: {} | ||
|
||
ingress: | ||
enabled: false | ||
ingressClassName: nginx | ||
annotations: {} | ||
hosts: | ||
tls: [] | ||
|
||
extraDeploy: [] | ||
|
||
podAnnotations: {} |