Skip to content

Commit

Permalink
chore(storcon): Set enable flag on NLB based service (#118)
Browse files Browse the repository at this point in the history
* chore(storcon): Set enable flag on NLB based service

This will be temporary set "serviceNLB" to keep existing Service with
Type LoadBalancer after migration we can set this to false to remove NLB.

This is no-op change to avoid any conflict with new service object

* feat(storcon): Add new service object for internal use

* feat(storcon): Add ingress object

* chore(storcon): Bump chart version to 1.3.0

* docs(storcon): Update values with new flags
  • Loading branch information
rahulinux authored Dec 16, 2024
1 parent 10a466e commit 7701a1f
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/neon-storage-controller/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: neon-storage-controller
description: Neon storage controller
type: application
version: 1.2.1
version: 1.3.0
appVersion: "0.1.0"
kubeVersion: "^1.18.x-x"
home: https://neon.tech
Expand Down
10 changes: 9 additions & 1 deletion charts/neon-storage-controller/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# neon-storage-controller

![Version: 1.2.1](https://img.shields.io/badge/Version-1.2.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![Lint and Test Charts](https://github.com/neondatabase/helm-charts/actions/workflows/lint-test.yaml/badge.svg)](https://github.com/neondatabase/helm-charts/actions/workflows/lint-test.yaml)
![Version: 1.3.0](https://img.shields.io/badge/Version-1.3.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) [![Lint and Test Charts](https://github.com/neondatabase/helm-charts/actions/workflows/lint-test.yaml/badge.svg)](https://github.com/neondatabase/helm-charts/actions/workflows/lint-test.yaml)

Neon storage controller

Expand Down Expand Up @@ -34,6 +34,13 @@ Kubernetes: `^1.18.x-x`
| image.repository | string | `"neondatabase/neon"` | Neondatabase image repository |
| image.tag | string | `"latest"` | Overrides the image tag whose default is the chart appVersion. |
| imagePullSecrets | list | `[]` | Specify docker-registry secret names as an array |
| ingress.annotations | object | `{}` | Additional annotations for Ingress resource. |
| ingress.className | string | `""` | Ingress class for controller |
| ingress.enabled | bool | `false` | Enable ingress controller resource. |
| ingress.hosts[0].host | string | `"chart-example.local"` | |
| ingress.hosts[0].paths[0].path | string | `"/"` | |
| ingress.hosts[0].paths[0].pathType | string | `"Prefix"` | |
| ingress.hosts[0].paths[0].protocol | string | `"TCP"` | |
| metrics.enabled | bool | `false` | Enable prometheus metrcis autodiscovery |
| metrics.serviceMonitor.enabled | bool | `false` | Create ServiceMonitor resource |
| metrics.serviceMonitor.interval | string | `"10s"` | Interval in which prometheus scrapes |
Expand Down Expand Up @@ -62,6 +69,7 @@ Kubernetes: `^1.18.x-x`
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | |
| serviceAccount.name | string | `""` | |
| serviceNLB | bool | `true` | |
| settings.chaosInterval | string | `""` | Chaos testing interval |
| settings.computeHookUrl | string | `""` | |
| settings.controlPlaneJwtToken | string | `""` | |
Expand Down
8 changes: 8 additions & 0 deletions charts/neon-storage-controller/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,11 @@ Create the name of the service account to use
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Returns service name
This will be use only for internal purpose e.g. ingress connecting to service
*/}}
{{- define "neon-storage-controller.serviceName" -}}
{{- printf "%s-svc" (include "neon-storage-controller.fullname" .) | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
44 changes: 44 additions & 0 deletions charts/neon-storage-controller/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "neon-storage-controller.fullname" . }}
labels:
{{- include "neon-storage-controller.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with .Values.ingress.className }}
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:
{{- range .paths }}
- path: {{ .path }}
{{- with .pathType }}
pathType: {{ . }}
{{- end }}
backend:
service:
name: {{ include "neon-storage-controller.serviceName" $ }}
port:
number: {{ $.Values.service.port }}
{{- end }}
{{- end }}
{{- end }}

18 changes: 18 additions & 0 deletions charts/neon-storage-controller/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{- if .Values.serviceNLB -}}
---
apiVersion: v1
kind: Service
metadata:
Expand All @@ -17,3 +19,19 @@ spec:
name: controller
selector:
{{- include "neon-storage-controller.selectorLabels" . | nindent 4 }}
{{- end }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "neon-storage-controller.serviceName" . }}
labels:
{{- include "neon-storage-controller.labels" . | nindent 4 }}
spec:
ports:
- port: {{ .Values.service.port }}
targetPort: controller
protocol: TCP
name: controller
selector:
{{- include "neon-storage-controller.selectorLabels" . | nindent 4 }}
19 changes: 19 additions & 0 deletions charts/neon-storage-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@ service:
# service.port -- controller listen port
port: 50051

# Temporary set "serviceNLB" to keep existing Service with Type LoadBalancer
# After migration we can set this to false to remove NLB
serviceNLB: true

ingress:
# ingress.enabled -- Enable ingress controller resource.
enabled: false
# ingress.className -- Ingress class for controller
className: ""
# ingress.annotations -- Additional annotations for Ingress resource.
annotations: {}
# external-dns.alpha.kubernetes.io/hostname: chart-example.local
hosts:
- host: chart-example.local
paths:
- path: /
# https://kubernetes.io/docs/concepts/services-networking/ingress/#path-types
pathType: Prefix
protocol: TCP
resources:
limits:
memory: 4Gi
Expand Down

0 comments on commit 7701a1f

Please sign in to comment.