Skip to content

Commit 94cc765

Browse files
committed
add gorse enterprise chart
1 parent 55c7bd3 commit 94cc765

File tree

20 files changed

+2573
-2
lines changed

20 files changed

+2573
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
To install a chart from this repo you need to run:
55

66
```bash
7-
$ helm repo add gorse-io https://charts.gorse.io
8-
$ helm search repo gorse-io
7+
helm repo add gorse-io https://charts.gorse.io
8+
helm search repo gorse-io
99
```
1010

1111
There are charts available in this repo:
1212

1313
| Name | Description |
1414
|-|-|
1515
| [gorse](./charts/gorse) | Gorse Recommender System Engine |
16+
| [gorse-enterprise](./charts/gorse-enterprise) | Helm Chart used by Gorse Manager |
1617
| [gorse-manager](./charts/gorse-manager) | Gorse Cloud Manager for Kubernetes |
1718

1819
> **NOTE:** The [bitnami](https://github.com/bitnami/charts) repository is required.

charts/gorse-enterprise/Chart.lock

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dependencies:
2+
- name: common
3+
repository: https://charts.bitnami.com/bitnami
4+
version: 2.2.3
5+
- name: mongodb
6+
repository: https://charts.bitnami.com/bitnami
7+
version: 13.6.8
8+
digest: sha256:c6f847899c00215775e7b10a031e1fb1cc7cbf464331627306bfb5e0cb7573b7
9+
generated: "2023-02-21T21:29:29.470136434+08:00"

charts/gorse-enterprise/Chart.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apiVersion: v2
2+
name: gorse-enterprise
3+
description: Helm Chart used by Gorse Manager
4+
icon: https://gorse.io/logo.png
5+
6+
# A chart can be either an 'application' or a 'library' chart.
7+
#
8+
# Application charts are a collection of templates that can be packaged into versioned archives
9+
# to be deployed.
10+
#
11+
# Library charts provide useful utilities or functions for the chart developer. They're included as
12+
# a dependency of application charts to inject those utilities and functions into the rendering
13+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
14+
type: application
15+
16+
# This is the chart version. This version number should be incremented each time you make changes
17+
# to the chart and its templates, including the app version.
18+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
19+
version: 0.4.1
20+
21+
# This is the version number of the application being deployed. This version number should be
22+
# incremented each time you make changes to the application. Versions are not expected to
23+
# follow Semantic Versioning. They should reflect the version the application is using.
24+
appVersion: 0.4.11
25+
26+
maintainers:
27+
- name: zhenghaoz
28+
email: zhangzhenghao@hotmail.com
29+
30+
dependencies:
31+
- name: common
32+
repository: https://charts.bitnami.com/bitnami
33+
tags:
34+
- bitnami-common
35+
version: 2.x.x
36+
- name: mongodb
37+
condition: mongodb.enabled
38+
version: 13.x.x
39+
repository: "https://charts.bitnami.com/bitnami"

charts/gorse-enterprise/README.md

Lines changed: 242 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
CHART NAME: {{ .Chart.Name }}
2+
CHART VERSION: {{ .Chart.Version }}
3+
APP VERSION: {{ .Chart.AppVersion }}
4+
5+
** Please be patient while the chart is being deployed **
6+
7+
{{- if .Values.master.ingress.enabled }}
8+
9+
1. Get the Gorse dashboard URL and associate hostname to your cluster external IP:
10+
11+
export CLUSTER_IP=$(minikube ip) # On Minikube. Use: `kubectl cluster-info` on others K8s clusters
12+
echo "Gorse dashboard URL: http{{ if .Values.master.ingress.tls }}s{{ end }}://{{ .Values.master.ingress.hostname }}/"
13+
echo "$CLUSTER_IP {{ .Values.master.ingress.hostname }}" | sudo tee -a /etc/hosts
14+
15+
{{- else }}
16+
{{- $port := .Values.master.service.ports.http | toString }}
17+
18+
1. Get the Gorse dashboard URL by running these commands:
19+
20+
{{- if contains "NodePort" .Values.master.service.type }}
21+
22+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "gorse.master.fullname" . }})
23+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
24+
echo "Gorse dashboard URL: http://$NODE_IP:$NODE_PORT/"
25+
26+
{{- else if contains "LoadBalancer" .Values.master.service.type }}
27+
28+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
29+
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ include "gorse.master.fullname" . }}'
30+
31+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "gorse.master.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
32+
echo "Gorse dashboard URL: http://$SERVICE_IP{{- if ne $port "80" }}:{{ .Values.service.ports.http }}{{ end }}/"
33+
34+
{{- else if contains "ClusterIP" .Values.master.service.type }}
35+
36+
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "gorse.master.fullname" . }} {{ .Values.master.service.ports.http }}:{{ .Values.master.service.ports.http }} &
37+
echo "Gorse dashboard URL: http://127.0.0.1{{- if ne $port "80" }}:{{ .Values.service.ports.http }}{{ end }}/"
38+
39+
{{- end }}
40+
{{- end }}
41+
42+
2. Login dashboard with the following credentials below:
43+
44+
echo Username: {{ .Values.gorse.dashboard.username }}
45+
echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath="{.data.dashboard-password}" | base64 -d)
46+
47+
{{- if .Values.server.ingress.enabled }}
48+
49+
3. Get the Gorse API endpoint and associate hostname to your cluster external IP:
50+
51+
export CLUSTER_IP=$(minikube ip) # On Minikube. Use: `kubectl cluster-info` on others K8s clusters
52+
echo "Gorse API endpoint: http{{ if .Values.server.ingress.tls }}s{{ end }}://{{ .Values.server.ingress.hostname }}/"
53+
echo "$CLUSTER_IP {{ .Values.server.ingress.hostname }}" | sudo tee -a /etc/hosts
54+
55+
{{- else }}
56+
{{- $port := .Values.master.service.ports.http | toString }}
57+
58+
3. Get the Gorse dashboard URL by running these commands:
59+
60+
{{- if contains "NodePort" .Values.server.service.type }}
61+
62+
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "gorse.server.fullname" . }})
63+
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
64+
echo "Gorse API endpoint: http://$NODE_IP:$NODE_PORT/"
65+
66+
{{- else if contains "LoadBalancer" .Values.server.service.type }}
67+
68+
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
69+
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ include "gorse.server.fullname" . }}'
70+
71+
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "gorse.server.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
72+
echo "Gorse API endpoint: http://$SERVICE_IP{{- if ne $port "80" }}:{{ .Values.service.ports.http }}{{ end }}/"
73+
74+
{{- else if contains "ClusterIP" .Values.server.service.type }}
75+
76+
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "gorse.server.fullname" . }} {{ .Values.server.service.ports.http }}:{{ .Values.server.service.ports.http }} &
77+
echo "Gorse API endpoint: http://127.0.0.1{{- if ne $port "80" }}:{{ .Values.service.ports.http }}{{ end }}/"
78+
79+
{{- end }}
80+
{{- end }}
81+
82+
4. Access RESTful APIs with the following key below:
83+
84+
echo APIKey: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath="{.data.api-key}" | base64 -d)
85+
86+
{{- include "common.warnings.rollingTag" .Values.master.image }}
87+
{{- include "common.warnings.rollingTag" .Values.server.image }}
88+
{{- include "common.warnings.rollingTag" .Values.worker.image }}
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
3+
{{/*
4+
Create a default fully qualified mongodb name.
5+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
6+
*/}}
7+
{{- define "gorse.mongodb.fullname" -}}
8+
{{- include "common.names.dependency.fullname" (dict "chartName" "mongodb" "chartValues" .Values.mongodb "context" $) -}}
9+
{{- end -}}
10+
11+
{{- define "gorse.master.fullname" -}}
12+
{{ printf "%s-master" (include "common.names.fullname" .) }}
13+
{{- end -}}
14+
15+
{{- define "gorse.server.fullname" -}}
16+
{{ printf "%s-server" (include "common.names.fullname" .) }}
17+
{{- end -}}
18+
19+
{{- define "gorse.worker.fullname" -}}
20+
{{ printf "%s-worker" (include "common.names.fullname" .) }}
21+
{{- end -}}
22+
23+
{{/*
24+
Returns the available value for certain key in an existing secret (if it exists),
25+
otherwise it generates a random value.
26+
*/}}
27+
{{- define "getValueFromSecret" }}
28+
{{- $len := (default 16 .Length) | int -}}
29+
{{- $obj := (lookup "v1" "Secret" .Namespace .Name).data -}}
30+
{{- if $obj }}
31+
{{- index $obj .Key | b64dec -}}
32+
{{- else -}}
33+
{{- randAlphaNum $len -}}
34+
{{- end -}}
35+
{{- end }}
36+
37+
{{- define "gorse.toTOMLArray" -}}
38+
{{- $list := list }}
39+
{{- range .List }}
40+
{{- $list = append $list (printf "\"%s\"" .) }}
41+
{{- end }}
42+
{{- printf "[%s]" (join ", " $list) }}
43+
{{- end }}
44+
45+
{{/*
46+
Return Gorse username
47+
*/}}
48+
{{- define "gorse.dashboardUsername" -}}
49+
{{- if not (empty .Values.gorse.dashboard.username) }}
50+
{{- .Values.gorse.dashboard.username -}}
51+
{{- else -}}
52+
{{- "gorse" -}}
53+
{{- end -}}
54+
{{- end -}}
55+
56+
{{/*
57+
Return Gorse password
58+
*/}}
59+
{{- define "gorse.dashboardPassword" -}}
60+
{{- if not (empty .Values.gorse.dashboard.password) }}
61+
{{- .Values.gorse.dashboard.password -}}
62+
{{- else -}}
63+
{{- include "getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" (include "common.names.fullname" .) "Length" 10 "Key" "dashboard-password") -}}
64+
{{- end -}}
65+
{{- end -}}
66+
67+
{{/*
68+
Return Gorse API Secret
69+
*/}}
70+
{{- define "gorse.apiKey" -}}
71+
{{- if not (empty .Values.gorse.api.key) }}
72+
{{- .Values.gorse.api.key -}}
73+
{{- else -}}
74+
{{- include "getValueFromSecret" (dict "Namespace" .Release.Namespace "Name" (include "common.names.fullname" .) "Length" 32 "Key" "api-key") -}}
75+
{{- end -}}
76+
{{- end -}}
77+
78+
{{/*
79+
Return the MongoDB Hostname
80+
*/}}
81+
{{- define "gorse.databaseHost" -}}
82+
{{- if .Values.mongodb.enabled }}
83+
{{- if eq .Values.mongodb.architecture "replication" }}
84+
{{- printf "%s-primary" (include "gorse.mongodb.fullname" .) | trunc 63 | trimSuffix "-" -}}
85+
{{- else -}}
86+
{{- printf "%s" (include "gorse.mongodb.fullname" .) -}}
87+
{{- end -}}
88+
{{- else -}}
89+
{{- printf "%s" .Values.externalDatabase.host -}}
90+
{{- end -}}
91+
{{- end -}}
92+
93+
{{/*
94+
Return the MongoDB Port
95+
*/}}
96+
{{- define "gorse.databasePort" -}}
97+
{{- if .Values.mongodb.enabled }}
98+
{{- printf "27017" -}}
99+
{{- else -}}
100+
{{- printf "%d" (.Values.externalDatabase.port | int ) -}}
101+
{{- end -}}
102+
{{- end -}}
103+
104+
{{/*
105+
Return the MongoDB Database Name
106+
*/}}
107+
{{- define "gorse.databaseName" -}}
108+
{{- if .Values.mongodb.enabled }}
109+
{{- printf "%s" .Values.mongodb.auth.database -}}
110+
{{- else -}}
111+
{{- printf "%s" .Values.externalDatabase.database -}}
112+
{{- end -}}
113+
{{- end -}}
114+
115+
{{/*
116+
Return the MongoDB User
117+
*/}}
118+
{{- define "gorse.databaseUser" -}}
119+
{{- if .Values.mongodb.enabled }}
120+
{{- .Values.mongodb.auth.username -}}
121+
{{- else -}}
122+
{{- .Values.externalDatabase.username -}}
123+
{{- end -}}
124+
{{- end -}}
125+
126+
{{/*
127+
Return the MongoDB Secret Name
128+
*/}}
129+
{{- define "gorse.databaseSecretName" -}}
130+
{{- if .Values.mongodb.enabled }}
131+
{{- if .Values.mongodb.auth.existingSecret -}}
132+
{{- printf "%s" .Values.mongodb.auth.existingSecret -}}
133+
{{- else -}}
134+
{{- printf "%s" (include "gorse.mongodb.fullname" .) -}}
135+
{{- end -}}
136+
{{- else if .Values.externalDatabase.existingSecret -}}
137+
{{- include "common.tplvalues.render" (dict "value" .Values.externalDatabase.existingSecret "context" $) -}}
138+
{{- else -}}
139+
{{- printf "%s-externaldb" (include "common.names.fullname" .) -}}
140+
{{- end -}}
141+
{{- end -}}
142+
143+
{{/*
144+
Return the MongoDB secret key
145+
*/}}
146+
{{- define "gorse.databaseSecretPasswordKey" -}}
147+
{{- if .Values.mongodb.enabled }}
148+
{{- printf "mongodb-passwords" -}}
149+
{{- else -}}
150+
{{- .Values.externalDatabase.existingSecretPasswordKey -}}
151+
{{- end -}}
152+
{{- end -}}

0 commit comments

Comments
 (0)