Skip to content

Commit

Permalink
fix: assertoor double ingress (#330)
Browse files Browse the repository at this point in the history
* fix: assertoor double ingress

* fix, create two ingresses

* newline

* fix ingress name

* fix ci
  • Loading branch information
barnabasbusa authored Aug 8, 2024
1 parent 741d7ff commit d6b3d4f
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 22 deletions.
2 changes: 1 addition & 1 deletion charts/assertoor/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ home: https://github.com/ethpandaops/assertoor
sources:
- https://github.com/ethpandaops/assertoor
type: application
version: 0.0.2
version: 0.0.3
appVersion: "1.0.0"
maintainers:
- name: pk910
Expand Down
11 changes: 8 additions & 3 deletions charts/assertoor/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# assertoor

![Version: 0.0.2](https://img.shields.io/badge/Version-0.0.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 0.0.3](https://img.shields.io/badge/Version-0.0.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

Testing tool that is capable of doing actions and checking conditions on ethereum pos networks.

Expand Down Expand Up @@ -69,7 +69,8 @@ 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 |
Expand All @@ -78,14 +79,18 @@ assertoorTests:
| ingress.hosts[0].host | string | `"chart-example.local"` | |
| ingress.hosts[0].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
68 changes: 65 additions & 3 deletions charts/assertoor/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "assertoor.fullname" . -}}
{{- $svcPort := include "assertoor.httpPort" . -}}
{{- $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 @@ -51,10 +51,72 @@ spec:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
number: {{ $svcPortPublic }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
servicePort: {{ $svcPortPublic }}
{{- end }}
{{- end }}
{{- 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 }}-admin
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:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPortAdmin }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPortAdmin }}
{{- end }}
{{- end }}
{{- end }}
Expand Down
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
2 changes: 1 addition & 1 deletion charts/assertoor/templates/tests/test-connection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ spec:
- --location
- --request
- GET
- '{{ include "assertoor.fullname" . }}:{{ include "assertoor.httpPort" . }}/'
- '{{ include "assertoor.fullname" . }}:{{ include "assertoor.httpPortAdmin" . }}/'
restartPolicy: Never
31 changes: 25 additions & 6 deletions charts/assertoor/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ ingress:
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# -- Ingress host
# -- Ingress host for public service
hosts:
- host: chart-example.local
paths: []
Expand All @@ -36,6 +36,25 @@ ingress:
# 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
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local

service:
# -- Service type
type: ClusterIP
Expand Down Expand Up @@ -135,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 @@ -182,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 d6b3d4f

Please sign in to comment.