-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
close CLOUD-94
- Loading branch information
Showing
37 changed files
with
891 additions
and
20 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
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,11 @@ | ||
apiVersion: v2 | ||
name: doc | ||
description: AFFiNE doc server | ||
type: application | ||
version: 0.0.0 | ||
appVersion: "0.20.0" | ||
dependencies: | ||
- name: gcloud-sql-proxy | ||
version: 0.0.0 | ||
repository: "file://../gcloud-sql-proxy" | ||
condition: .global.database.gcloud.enabled |
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,16 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "doc.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "doc.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "doc.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "doc.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT | ||
{{- 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,63 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "doc.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 "doc.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 "doc.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "doc.labels" -}} | ||
helm.sh/chart: {{ include "doc.chart" . }} | ||
{{ include "doc.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
monitoring: enabled | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "doc.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "doc.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "doc.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "doc.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
105 changes: 105 additions & 0 deletions
105
.github/helm/affine/charts/doc/templates/deployment.yaml
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,105 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "doc.fullname" . }} | ||
labels: | ||
{{- include "doc.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "doc.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "doc.selectorLabels" . | nindent 8 }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "doc.serviceAccountName" . }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
env: | ||
- name: AFFINE_PRIVATE_KEY | ||
valueFrom: | ||
secretKeyRef: | ||
name: "{{ .Values.global.secret.secretName }}" | ||
key: key | ||
- name: NODE_ENV | ||
value: "{{ .Values.env }}" | ||
- name: NODE_OPTIONS | ||
value: "--max-old-space-size=4096" | ||
- name: NO_COLOR | ||
value: "1" | ||
- name: DEPLOYMENT_TYPE | ||
value: "affine" | ||
- name: SERVER_FLAVOR | ||
value: "doc" | ||
- name: AFFINE_ENV | ||
value: "{{ .Release.Namespace }}" | ||
- name: DATABASE_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: pg-postgresql | ||
key: postgres-password | ||
- name: DATABASE_URL | ||
value: postgres://{{ .Values.global.database.user }}:$(DATABASE_PASSWORD)@{{ .Values.global.database.url }}:{{ .Values.global.database.port }}/{{ .Values.global.database.name }} | ||
- name: REDIS_SERVER_ENABLED | ||
value: "true" | ||
- name: REDIS_SERVER_HOST | ||
value: "{{ .Values.global.redis.host }}" | ||
- name: REDIS_SERVER_PORT | ||
value: "{{ .Values.global.redis.port }}" | ||
- name: REDIS_SERVER_USER | ||
value: "{{ .Values.global.redis.username }}" | ||
- name: REDIS_SERVER_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: redis | ||
key: redis-password | ||
- name: REDIS_SERVER_DATABASE | ||
value: "{{ .Values.global.redis.database }}" | ||
- name: AFFINE_SERVER_PORT | ||
value: "{{ .Values.service.port }}" | ||
- name: AFFINE_SERVER_SUB_PATH | ||
value: "{{ .Values.app.path }}" | ||
- name: AFFINE_SERVER_HOST | ||
value: "{{ .Values.app.host }}" | ||
- name: AFFINE_SERVER_HTTPS | ||
value: "{{ .Values.app.https }}" | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.service.port }} | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /info | ||
port: http | ||
initialDelaySeconds: {{ .Values.probe.initialDelaySeconds }} | ||
readinessProbe: | ||
httpGet: | ||
path: /info | ||
port: http | ||
initialDelaySeconds: {{ .Values.probe.initialDelaySeconds }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- 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,19 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "doc.fullname" . }} | ||
labels: | ||
{{- include "doc.labels" . | nindent 4 }} | ||
{{- with .Values.service.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
name: http | ||
selector: | ||
{{- include "doc.selectorLabels" . | nindent 4 }} |
12 changes: 12 additions & 0 deletions
12
.github/helm/affine/charts/doc/templates/serviceaccount.yaml
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,12 @@ | ||
{{- if .Values.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "doc.serviceAccountName" . }} | ||
labels: | ||
{{- include "doc.labels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
15 changes: 15 additions & 0 deletions
15
.github/helm/affine/charts/doc/templates/tests/test-connection.yaml
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,15 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: "{{ include "doc.fullname" . }}-test-connection" | ||
labels: | ||
{{- include "doc.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": test | ||
spec: | ||
containers: | ||
- name: wget | ||
image: busybox | ||
command: ['wget'] | ||
args: ['{{ include "doc.fullname" . }}:{{ .Values.service.port }}'] | ||
restartPolicy: Never |
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,38 @@ | ||
replicaCount: 1 | ||
image: | ||
repository: ghcr.io/toeverything/affine-graphql | ||
pullPolicy: IfNotPresent | ||
tag: '' | ||
|
||
imagePullSecrets: [] | ||
nameOverride: '' | ||
fullnameOverride: '' | ||
# map to NODE_ENV environment variable | ||
env: 'production' | ||
app: | ||
# AFFINE_SERVER_SUB_PATH | ||
path: '' | ||
# AFFINE_SERVER_HOST | ||
host: '0.0.0.0' | ||
https: true | ||
serviceAccount: | ||
create: true | ||
annotations: {} | ||
name: 'affine-doc' | ||
|
||
podAnnotations: {} | ||
|
||
podSecurityContext: | ||
fsGroup: 2000 | ||
|
||
resources: | ||
requests: | ||
cpu: '2' | ||
memory: 4Gi | ||
|
||
probe: | ||
initialDelaySeconds: 20 | ||
|
||
nodeSelector: {} | ||
tolerations: [] | ||
affinity: {} |
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
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
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
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
Oops, something went wrong.