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

[nethgate] fix in migrator and image tag #122

Merged
merged 14 commits into from
May 14, 2024
8 changes: 3 additions & 5 deletions charts/nethgate/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
apiVersion: v2
description: The Cloud-Native Ingress and API-management
home: https://konghq.com/
icon: https://s3.amazonaws.com/downloads.kong/universe/assets/icon-kong-inc-large.png
maintainers:
- name: team-k8s-bot
email: team-k8s@konghq.com
- name: anishgehlot
email: anish@nethermind.io
name: kong
sources:
- https://github.com/Kong/charts/tree/main/charts/kong
version: 2.33.3
version: 2.33.4
appVersion: "3.5"
dependencies:
- name: postgresql
Expand Down
3 changes: 2 additions & 1 deletion charts/nethgate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1231,4 +1231,5 @@ community via [Kong Nation](https://discuss.konghq.com).
Please do not open issues in [this](https://github.com/helm/charts) repository
as the maintainers will not be notified and won't respond.

## Nethgate DOC
## Nethgate DOC
if you run nethgate enable `deployment.nethgate.enabled=true`
56 changes: 56 additions & 0 deletions charts/nethgate/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,22 @@ app.kubernetes.io/component: app
app.kubernetes.io/instance: "{{ .Release.Name }}"
{{- end -}}

{{- define "kong.nethagateMetaLabels" -}}
app.kubernetes.io/app: nethgate
{{- end -}}

{{- define "kong.nethagateSelectorLabels" -}}
app.kubernetes.io/app: nethgate
{{- end -}}

{{- define "kong.migratorMetaLabels" -}}
app.kubernetes.io/app: migrator
{{- end -}}

{{- define "kong.migratorSelectorLabels" -}}
app.kubernetes.io/app: migrator
{{- end -}}

{{- define "kong.postgresql.fullname" -}}
{{- $name := default "postgresql" .Values.postgresql.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
Expand Down Expand Up @@ -948,6 +964,46 @@ Use the Pod security context defined in Values or set the UID by default
{{ .Values.securityContext | toYaml }}
{{- end -}}
{{/*
Custom ENV for Nethgate
*/}}
{{- define "kong.nethgate" -}}
- name: KONG_NGINX_DAEMON
value: "off"
{{- $customNethgateEnv := dict -}}
{{- range $key, $val := .Values.deployment.customNethgateEnv }}
{{- $upper := upper $key -}}
{{- $_ := set $customNethgateEnv $upper $val -}}
{{- end -}}
{{- template "kong.nethgateEnv" $customNethgateEnv -}}
{{- end -}}
{{- define "kong.nethgateEnv" -}}
{{- $customNethgateEnv := . -}}
{{- range keys . | sortAlpha }}
{{- $val := pluck . $customNethgateEnv | first -}}
{{- $valueType := printf "%T" $val -}}
{{ if eq $valueType "map[string]interface {}" }}
- name: {{ . }}
{{ toYaml $val | indent 2 -}}
{{- else if eq $valueType "string" }}
{{- if regexMatch "valueFrom" $val }}
- name: {{ . }}
{{ $val | indent 2 }}
{{- else }}
- name: {{ . }}
value: {{ $val | quote }}
{{- end }}
{{- else }}
- name: {{ . }}
value: {{ $val | quote }}
{{- end }}
{{- end -}}
{{- end -}}
{{- define "kong.no_daemon_env" -}}
{{- template "kong.env" . }}
- name: KONG_NGINX_DAEMON
Expand Down
19 changes: 6 additions & 13 deletions charts/nethgate/templates/migrator_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ metadata:
name: {{ template "kong.fullname" . }}-migrator
namespace: {{ template "kong.namespace" . }}
labels:
{{- include "kong.metaLabels" . | nindent 4 }}
app.kubernetes.io/component: app
{{- include "kong.migratorMetaLabels" . | nindent 4 }}
{{- if .Values.deploymentAnnotations }}
annotations:
{{- range $key, $value := .Values.deploymentAnnotations }}
Expand All @@ -17,7 +16,7 @@ spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "kong.selectorLabels" . | nindent 6 }}
{{- include "kong.migratorSelectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
Expand All @@ -27,13 +26,7 @@ spec:
{{- end }}
{{- end }}
labels:
{{- include "kong.metaLabels" . | nindent 8 }}
app.kubernetes.io/component: app
app: {{ template "kong.fullname" . }}
version: {{ .Chart.AppVersion | quote }}
{{- if .Values.podLabels }}
{{ include "kong.renderTpl" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
{{- end }}
{{- include "kong.migratorMetaLabels" . | nindent 8 }}
spec:
{{- if .Values.deployment.voyager_migrator.image.pullSecrets }}
imagePullSecrets:
Expand All @@ -44,13 +37,13 @@ spec:
{{- if .Values.deployment.kong.enabled }}
containers:
- name: {{ template "kong.fullname" . }}-migrator
image: {{ .Values.deployment.voyager_migrator.image.repository }}:{{ .Values.deployment.voyager_migrator.image.tag }}
image: {{ .Values.deployment.voyager_migrator.image.repository }}:{{ .Values.deployment.voyager_migrator.image.migrator_tag }}
imagePullPolicy: {{ .Values.deployment.voyager_migrator.image.pullPolicy }}
securityContext:
{{ toYaml .Values.containerSecurityContext | nindent 10 }}
env:
{{- include "kong.no_daemon_env" . | nindent 8 }}
command: [{{ .Values.deployment.dvoyager_migrator.CMD | quote }}]
{{- include "kong.nethgate" . | nindent 8 }}
command: ["voyager_migrator", "migrate"]
volumeMounts:
{{- include "kong.volumeMounts" . | nindent 10 }}
{{- include "kong.userDefinedVolumeMounts" .Values.deployment | nindent 10 }}
Expand Down
19 changes: 6 additions & 13 deletions charts/nethgate/templates/nethgate_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ metadata:
name: {{ template "kong.fullname" . }}-nethgate
namespace: {{ template "kong.namespace" . }}
labels:
{{- include "kong.metaLabels" . | nindent 4 }}
app.kubernetes.io/component: app
{{- include "kong.nethagateMetaLabels" . | nindent 4 }}
{{- if .Values.deploymentAnnotations }}
annotations:
{{- range $key, $value := .Values.deploymentAnnotations }}
Expand All @@ -17,7 +16,7 @@ spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "kong.selectorLabels" . | nindent 6 }}
{{- include "kong.nethagateSelectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
Expand All @@ -27,29 +26,23 @@ spec:
{{- end }}
{{- end }}
labels:
{{- include "kong.metaLabels" . | nindent 8 }}
app.kubernetes.io/component: app
app: {{ template "kong.fullname" . }}
version: {{ .Chart.AppVersion | quote }}
{{- if .Values.podLabels }}
{{ include "kong.renderTpl" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
{{- end }}
{{- include "kong.nethagateMetaLabels" . | nindent 8 }}
spec:
{{- if .Values.image.pullSecrets }}
imagePullSecrets:
{{- range .Values.image.pullSecrets }}
{{- range .Values.deployment.nethgate.image.pullSecrets }}
- name: {{ . }}
{{- end }}
{{- end }}
{{- if .Values.deployment.kong.enabled }}
containers:
- name: {{ template "kong.fullname" . }}-nethgate
image: {{ include "kong.getRepoTag" .Values.image }}
image: {{ .Values.deployment.nethgate.image.repository }}:{{ .Values.deployment.nethgate.image.nethgate_tag }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
securityContext:
{{ toYaml .Values.containerSecurityContext | nindent 10 }}
env:
{{- include "kong.no_daemon_env" . | nindent 8 }}
{{- include "kong.nethgate" . | nindent 8 }}
command: ["nethgate", "server"]
ports:
- name: nethgate
Expand Down
7 changes: 2 additions & 5 deletions charts/nethgate/templates/service-nethgate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ metadata:
{{- end }}
{{- end }}
labels:
{{- include "kong.metaLabels" . | nindent 4 }}
app.kubernetes.io/component: app
{{- include "kong.nethagateMetaLabels" . | nindent 4 }}
spec:
{{- if .Values.deployment.nethgate.svc.loadBalancerIP }}
loadBalancerIP: {{ .Values.deployment.nethgate.svc.loadBalancerIP }}
Expand All @@ -23,8 +22,6 @@ spec:
port: {{ .Values.deployment.nethgate.port }}
targetPort: {{ .Values.deployment.nethgate.port }}
selector:
app.kubernetes.io/name: {{ template "kong.name" . }}
app.kubernetes.io/component: app
app.kubernetes.io/instance: "{{ .Release.Name }}"
{{- include "kong.nethagateSelectorLabels" . | nindent 6 }}
type: {{ .Values.deployment.nethgate.svc.type }}
{{- end -}}
17 changes: 15 additions & 2 deletions charts/nethgate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ deployment:
# Setting this to false with ingressController.enabled=true will create a
# controller-only release.
enabled: true

nethgate:
enabled: false
image:
repository: nethermindeth/nethgate
nethgate_tag: 0.0.1-dev102
pullPolicy: "IfNotPresent"
pullSecrets:
- "regcred"
port: "8080"
svc:
# annotations: {}
Expand All @@ -30,10 +37,16 @@ deployment:
enabled: false
image:
repository: nethermindeth/voyager_migrator
tag: 0.0.1-dev102
migrator_tag: 0.0.1-dev102
pullPolicy: "IfNotPresent"
pullSecrets:
- "regcred"
CMD: voyager_migrator
customNethgateEnv:
NETHGATE_SECRET:
valueFrom:
secretKeyRef:
key: secret
name: nethgate-dev-secret

## Minimum number of seconds for which a newly created pod should be ready without any of its container crashing,
## for it to be considered available.
Expand Down
Loading