Skip to content

Commit

Permalink
fix, create two ingresses
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa committed Aug 8, 2024
1 parent 8678282 commit 0f624b0
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 30 deletions.
11 changes: 7 additions & 4 deletions charts/assertoor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,25 +69,28 @@ assertoorTests:
| extraVolumes | list | `[]` | Additional volumes |
| fullnameOverride | string | `""` | Overrides the chart's computed fullname |
| globalVariables | object | `{"walletPrivkey":"feedbeef12340000feedbeef12340000feedbeef12340000feedbeef12340000"}` | global assertoor variables -- global variables are passed to all tests. |
| httpPort | int | `8080` | HTTP port for assertoor interface |
| httpPort | int | `8082` | HTTP port for assertoor interface |
| httpPortAdmin | int | `8080` | HTTP port for assertoor admin interface |
| image.pullPolicy | string | `"IfNotPresent"` | assertoor container pull policy |
| image.repository | string | `"ethpandaops/assertoor"` | assertoor container image repository |
| image.tag | string | `"latest"` | assertoor container image tag |
| ingress.annotations | object | `{}` | Annotations for Ingress |
| ingress.enabled | bool | `false` | Ingress resource for the HTTP API |
| ingress.hosts[0].host | string | `"chart-example.local"` | |
| ingress.hosts[0].paths | list | `[]` | |
| ingress.hosts[1].host | string | `"chart-example-admin.local"` | |
| ingress.hosts[1].paths | list | `[]` | |
| ingress.tls | list | `[]` | Ingress TLS |
| ingressAdmin.annotations | object | `{}` | Annotations for Ingress |
| ingressAdmin.enabled | bool | `false` | Ingress resource for the HTTP API -- This is the admin interface -- Please ensure you put this behind authorization |
| ingressAdmin.hosts[0].host | string | `"chart-example-admin.local"` | |
| ingressAdmin.hosts[0].paths | list | `[]` | |
| ingressAdmin.tls | list | `[]` | Ingress TLS |
| initContainers | list | `[]` | Additional init containers |
| nameOverride | string | `""` | Overrides the chart's name |
| nodeSelector | object | `{}` | Node selector for pods |
| podAnnotations | object | `{}` | Pod annotations |
| podDisruptionBudget | object | `{}` | Define the PodDisruptionBudget spec If not set then a PodDisruptionBudget will not be created |
| podLabels | object | `{}` | Pod labels |
| priorityClassName | string | `nil` | Pod priority class |
| publicHttpPort | int | `8082` | HTTP port for assertoor public interface |
| resources | object | `{}` | Resource requests and limits |
| securityContext | object | See `values.yaml` | The security context for pods |
| service.type | string | `"ClusterIP"` | Service type |
Expand Down
6 changes: 3 additions & 3 deletions charts/assertoor/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ Create the name of the service account to use
{{- end }}

{{- define "assertoor.httpPort" -}}
{{- printf "8080" -}}
{{- printf "8082" -}}
{{- end -}}

{{- define "assertoor.publicHttpPort" -}}
{{- printf "8082" -}}
{{- define "assertoor.httpPortAdmin" -}}
{{- printf "8080" -}}
{{- end -}}
4 changes: 2 additions & 2 deletions charts/assertoor/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ spec:
- name: http
containerPort: {{ include "assertoor.httpPort" . }}
protocol: TCP
- name: public-http
containerPort: {{ include "assertoor.publicHttpPort" . }}
- name: http-admin
containerPort: {{ include "assertoor.httpPortAdmin" . }}
protocol: TCP
resources:
{{- toYaml .Values.resources | nindent 12 }}
Expand Down
59 changes: 49 additions & 10 deletions charts/assertoor/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "assertoor.fullname" . -}}
{{- $svcPortAdmin := include "assertoor.httpPort" . -}}
{{- $svcPortPublic := include "assertoor.publicHttpPort" . -}}
{{- $svcPortPublic := include "assertoor.httpPort" . -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
Expand Down Expand Up @@ -39,7 +38,6 @@ spec:
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
{{- if and (contains "admin" .host) (semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion) }}
- host: {{ .host | quote }}
http:
paths:
Expand All @@ -53,13 +51,55 @@ spec:
service:
name: {{ $fullName }}
port:
number: {{ $svcPortAdmin }}
number: {{ $svcPortPublic }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPortAdmin }}
servicePort: {{ $svcPortPublic }}
{{- end }}
{{- end }}
{{- else }}
{{- end }}
{{- end }}
---
{{- if .Values.ingressAdmin.enabled -}}
{{- $fullName := include "assertoor.fullname" . -}}
{{- $svcPortAdmin := include "assertoor.httpPortAdmin" . -}}
{{- if and .Values.ingressAdmin.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingressAdmin.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingressAdmin.annotations "kubernetes.io/ingress.class" .Values.ingressAdmin.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "assertoor.labels" . | nindent 4 }}
{{- with .Values.ingressAdmin.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingressAdmin.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingressAdmin.className }}
{{- end }}
{{- if .Values.ingressAdmin.tls }}
tls:
{{- range .Values.ingressAdmin.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingressAdmin.hosts }}
- host: {{ .host | quote }}
http:
paths:
Expand All @@ -73,12 +113,11 @@ spec:
service:
name: {{ $fullName }}
port:
number: {{ $svcPortPublic }}
number: {{ $svcPortAdmin }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPortPublic }}
servicePort: {{ $svcPortAdmin }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
6 changes: 3 additions & 3 deletions charts/assertoor/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ spec:
targetPort: http
protocol: TCP
name: http
- port: {{ include "assertoor.publicHttpPort" . }}
targetPort: public-http
- port: {{ include "assertoor.httpPortAdmin" . }}
targetPort: http-admin
protocol: TCP
name: public-http
name: http-admin
{{- if .Values.extraPorts }}
{{ toYaml .Values.extraPorts | nindent 4}}
{{- end }}
Expand Down
31 changes: 23 additions & 8 deletions charts/assertoor/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,27 @@ ingress:
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# -- Ingress host
# -- if you set "admin" in the hostname it will use the admin service (8080)
# -- if you do not set admin in the hostname it will use the public service (8082)
# -- Ingress host for public service
hosts:
- host: chart-example.local
paths: []
# -- Ingress TLS
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local

ingressAdmin:
# -- Ingress resource for the HTTP API
# -- This is the admin interface
# -- Please ensure you put this behind authorization
enabled: false
# -- Annotations for Ingress
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# -- Ingress host for admin service
hosts:
- host: chart-example-admin.local
paths: []
# -- Ingress TLS
Expand Down Expand Up @@ -139,10 +154,10 @@ extraEnv: []


# -- HTTP port for assertoor interface
httpPort: 8080
httpPort: 8082

# -- HTTP port for assertoor public interface
publicHttpPort: 8082
# -- HTTP port for assertoor admin interface
httpPortAdmin: 8080

# -- An array of endpoints to use for assertoor
# -- executionUrl & consensusUrl are the only required fields
Expand Down Expand Up @@ -186,10 +201,10 @@ config: |
web:
server:
host: "0.0.0.0"
port: {{ .Values.httpPort }}
port: {{ .Values.httpPortAdmin }}
publicServer:
host: "0.0.0.0"
port: {{ .Values.publicHttpPort }}
port: {{ .Values.httpPort }}
frontend:
enabled: {{ .Values.assertoorFrontendEnabled }}
api:
Expand Down

0 comments on commit 0f624b0

Please sign in to comment.