Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add storage components pageserver safekeeper #91

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions charts/neon-pageserver/.helmignore
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/
19 changes: 19 additions & 0 deletions charts/neon-pageserver/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: neon-pageserver
description: Neon Pageserver
type: application
version: 1.0.0
appVersion: "0.1.0"
kubeVersion: "^1.18.x-x"
home: https://neon.tech
sources:
- https://github.com/neondatabase/neon
dependencies:
- name: neon-storage-broker
version: "1.2.*"
repository: "https://neondatabase.github.io/helm-charts"
condition: settings.s3.enabled
- name: neon-minio
version: "1.0.*"
repository: "https://neondatabase.github.io/helm-charts"
condition: settings.broker.enabled
86 changes: 86 additions & 0 deletions charts/neon-pageserver/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "neon-pageserver.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 "neon-pageserver.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 }}
{{- define "neon-s3.fullname" -}}
{{- if .Values.settings.s3.fullnameOverride }}
{{- .Values.settings.s3.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.settings.s3.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}
{{- define "neon-broker.fullname" -}}
{{- if .Values.settings.broker.fullnameOverride }}
{{- .Values.settings.broker.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.settings.broker.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 "neon-pageserver.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common for Service and Deployment labels
*/}}
{{- define "neon-pageserver.labels" -}}
helm.sh/chart: {{ include "neon-pageserver.chart" . }}
{{ include "neon-pageserver.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

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

{{/*
Create the name of the service account to use
*/}}
{{- define "neon-pageserver.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "neon-pageserver.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
101 changes: 101 additions & 0 deletions charts/neon-pageserver/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "neon-pageserver.fullname" . }}
labels:
{{- include "neon-pageserver.labels" . | nindent 4 }}
spec:
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
replicas: 1
# Which pods the Deployment is managing (duplicates template.metadata.labels).
selector:
matchLabels:
{{- include "neon-pageserver.selectorLabels" . | nindent 6 }}
# Pod template.
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
# Labels set on created pods.
labels:
{{- include "neon-pageserver.selectorLabels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "neon-pageserver.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- "/usr/local/bin/pageserver -D /data/.neon/ -c \"broker_endpoint='${BROKER_ENDPOINT}'\" -c \"listen_pg_addr='0.0.0.0:{{ .Values.service.port }}'\" -c \"listen_http_addr='0.0.0.0:{{ .Values.service.httpPort }}'\" -c \"remote_storage={endpoint='${S3_ENDPOINT}', bucket_name='{{ .Values.settings.s3.bucket }}', bucket_region='{{ .Values.settings.s3.region }}', prefix_in_bucket='/pageserver/'}\""
command:
- /bin/sh
- -c
{{- if .Values.settings }}
env:
- name: AWS_ACCESS_KEY_ID
value: {{ .Values.settings.s3.accessKey.rootUser }}
- name: AWS_SECRET_ACCESS_KEY
value: {{ .Values.settings.s3.accessKey.rootPassword }}
- name: BROKER_ENDPOINT
value: {{ printf "http://%s:%s" (include "neon-broker.fullname" .) .Values.settings.broker.port }}
- name: S3_ENDPOINT
value: {{ printf "http://%s:%s" (include "neon-s3.fullname" .) .Values.settings.s3.port }}
{{- end }}
ports:
- name: service
containerPort: {{ .Values.service.port }}
protocol: TCP
- name: monitor
containerPort: {{ .Values.service.httpPort }}
protocol: TCP
startupProbe:
httpGet:
path: /metrics
port: monitor
initialDelaySeconds: 10
timeoutSeconds: 5
periodSeconds: 10
failureThreshold: 30
livenessProbe:
httpGet:
path: /metrics
port: monitor
periodSeconds: 15
timeoutSeconds: 10
readinessProbe:
httpGet:
path: /metrics
port: monitor
periodSeconds: 15
timeoutSeconds: 10
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 }}
4 changes: 4 additions & 0 deletions charts/neon-pageserver/templates/extra-manifests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{- range .Values.extraManifests }}
---
{{ tpl (toYaml .) $ }}
{{- end }}
23 changes: 23 additions & 0 deletions charts/neon-pageserver/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "neon-pageserver.fullname" . }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "neon-pageserver.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: service
protocol: TCP
name: service
- port: {{ .Values.service.httpPort }}
targetPort: monitor
protocol: TCP
name: monitor
selector:
{{- include "neon-pageserver.selectorLabels" . | nindent 4 }}
12 changes: 12 additions & 0 deletions charts/neon-pageserver/templates/serviceaccount.yaml
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 "neon-pageserver.serviceAccountName" . }}
labels:
{{- include "neon-pageserver.labels" . | nindent 4 }}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
110 changes: 110 additions & 0 deletions charts/neon-pageserver/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Default values for neon-storage-broker.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

image:
# -- Neondatabase image repository
repository: neondatabase/neon
# -- image pull policy
pullPolicy: Always
# -- Overrides the image tag whose default is the chart appVersion.
tag: "latest"

# -- Specify docker-registry secret names as an array
imagePullSecrets: []

# -- String to partially override neon-storage-broker.fullname template (will maintain the release name)
nameOverride: ""
# -- String to fully override neon-storage-broker.fullname template
fullnameOverride: ""

# Pageserver settings
settings:
# connection settings for S3
s3:
enabled: true
accessKey:
# -- Access key for s3
rootUser: minio
# -- Access key for s3
rootPassword: password
# -- s3 service name
nameOverride: "neon-minio"
fullnameOverride: ""
port: "9000"
bucket: "neon"
region: "eu-north-1"
# connection settings for broker
broker:
enabled: true
# -- Storage broker service name
nameOverride: "neon-storage-broker"
fullnameOverride: ""
port: "50051"

serviceAccount:
# serviceAccount.create - Specifies whether a service account should be created
create: true
# serviceAccount.annotations -- Annotations to add to the service account
annotations: {}
# serviceAccount.name - The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""

# -- Annotations for neon-storage-broker pods
podAnnotations: {}

# -- Additional labels for neon-storage-broker pods
podLabels: {}
# neon_service: broker
# neon_env: staging
# neon_region: us-west-1
# neon_region_slug: virginia

# -- neon-storage-broker's pods Security Context
podSecurityContext: {}
# fsGroup: 2000

# -- neon-storage-broker's containers Security Context
securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
# service.annotations -- Annotations to add to the service
annotations: {}
type: ClusterIP
# service.port -- pageserver listen port
port: 6400
httpPort: 9898

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
#
# resources.limits -- The resources limits for the container
# resources.requests The requested resources for the container
#
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

# -- Node labels for pod assignment.
nodeSelector: {}

# -- Tolerations for pod assignment.
tolerations: []

# -- Affinity for pod assignment
affinity: {}

extraManifests: []
Loading