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

feat: rm-ing p2p from arbitrum charts #177

Merged
merged 2 commits into from
Oct 27, 2023
Merged
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
2 changes: 1 addition & 1 deletion charts/arbitrum-classic/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.3
version: 0.1.4

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
7 changes: 1 addition & 6 deletions charts/arbitrum-classic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Deploy and scale [Arbitrum-Classic](https://github.com/OffchainLabs/arbitrum) inside Kubernetes with ease

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.1.3](https://img.shields.io/badge/Version-0.1.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.4.5-e97c1a4](https://img.shields.io/badge/AppVersion-v1.4.5--e97c1a4-informational?style=flat-square)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.1.4](https://img.shields.io/badge/Version-0.1.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v1.4.5-e97c1a4](https://img.shields.io/badge/AppVersion-v1.4.5--e97c1a4-informational?style=flat-square)

## Features

Expand Down Expand Up @@ -123,11 +123,6 @@ We do not recommend that you upgrade the application by overriding `image.tag`.
| arbitrum.extraArgs | Additional CLI arguments to pass to `arb-node` | list | `[]` |
| arbitrum.extraLabels | Extra labels to attach to the Pod for matching against | object | `{}` |
| arbitrum.nodeSelector | | object | `{}` |
| arbitrum.p2pNodePort.enabled | Expose P2P port via NodePort | bool | `false` |
| arbitrum.p2pNodePort.initContainer.image.pullPolicy | Container pull policy | string | `"IfNotPresent"` |
| arbitrum.p2pNodePort.initContainer.image.repository | Container image to fetch nodeport information | string | `"lachlanevenson/k8s-kubectl"` |
| arbitrum.p2pNodePort.initContainer.image.tag | Container tag | string | `"v1.25.4"` |
| arbitrum.p2pNodePort.port | NodePort to be used. Must be unique. | int | `31000` |
| arbitrum.podAnnotations | Annotations for the `Pod` | object | `{}` |
| arbitrum.podSecurityContext | Pod-wide security context | object | `{"fsGroup":101337,"runAsGroup":101337,"runAsNonRoot":true,"runAsUser":101337}` |
| arbitrum.resources | | object | `{}` |
Expand Down
12 changes: 0 additions & 12 deletions charts/arbitrum-classic/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,6 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{- define "arbitrum-classic.p2pPort" -}}
{{- if .p2pNodePort.enabled }}
{{- print .p2pNodePort.port }}
{{- else }}
{{- printf "30303" -}}
{{- end }}
{{- end -}}

{{- define "arbitrum-classic.replicas" -}}
{{- if .p2pNodePort.enabled }}
{{- print 1 }}
{{ else }}
{{- default 1 .replicaCount }}
{{- end}}
{{- end -}}
32 changes: 1 addition & 31 deletions charts/arbitrum-classic/templates/arbitrum/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,4 @@ spec:
{{- end }}
selector:
{{- include "arbitrum-classic.selectorLabels" . | nindent 4 }}
{{- $componentLabel | nindent 4 }}
{{- if $values.p2pNodePort.enabled }}
{{- $port := $values.p2pNodePort.port }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "arbitrum-classic.fullname" . }}-p2p-0
labels:
{{- include "arbitrum-classic.labels" . | nindent 4 }}
{{- $componentLabel | nindent 4 }}
pod: {{ include "arbitrum-classic.fullname" . }}-0
type: p2p # this label is used by the initContainer to select this service
spec:
type: NodePort
externalTrafficPolicy: Local
ports:
- name: tcp-p2p
port: {{ include "arbitrum-classic.p2pPort" $values }}
protocol: TCP
targetPort: tcp-p2p
nodePort: {{ $port }}
- name: udp-p2p
port: {{ include "arbitrum-classic.p2pPort" $values }}
protocol: UDP
targetPort: udp-p2p
nodePort: {{ $port }}
selector:
{{- include "arbitrum-classic.selectorLabels" . | nindent 4 }}
statefulset.kubernetes.io/pod-name: "{{ include "arbitrum-classic.fullname" $ }}-0"
{{- end }}
{{- $componentLabel | nindent 4 }}
51 changes: 1 addition & 50 deletions charts/arbitrum-classic/templates/arbitrum/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ spec:
volumes:
- name: tmp # this is to provide a writable /tmp even with securityContext.readOnlyRootFilesystem=true
emptyDir: {}
{{- if $values.p2pNodePort.enabled }}
- name: env-nodeport
emptyDir: {}
{{- end }}
initContainers:
{{- if $values.restoreSnapshot.enabled }}
- name: init-snapshot
Expand Down Expand Up @@ -103,37 +99,6 @@ spec:
{{- end }}
{{- end }}
{{- end }}
{{- if $values.p2pNodePort.enabled }}
- name: init-nodeport
image: "{{ $values.p2pNodePort.initContainer.image.repository }}:{{ $values.p2pNodePort.initContainer.image.tag }}"
imagePullPolicy: {{ $values.p2pNodePort.initContainer.image.pullPolicy }}
securityContext:
runAsNonRoot: false
runAsUser: 0
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
command:
- sh
- -c
- >
set -ex;
export EXTERNAL_PORT=$(kubectl get services {{ include "arbitrum-classic.fullname" . }}-p2p-0 -o jsonpath='{.spec.ports[0].nodePort}');
export EXTERNAL_IP=$(kubectl get nodes "${NODE_NAME}" -o jsonpath='{.status.addresses[?(@.type=="ExternalIP")].address}');
export EXTERNAL_IP=${EXTERNAL_IP:-$(curl --silent v4.ident.me)};
echo "EXTERNAL_PORT=$EXTERNAL_PORT" > /env/init-nodeport;
echo "EXTERNAL_IP=$EXTERNAL_IP" >> /env/init-nodeport;
cat /env/init-nodeport;
volumeMounts:
- name: env-nodeport
mountPath: /env
{{- end }}
containers:
- name: {{ $componentName }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand All @@ -147,20 +112,16 @@ spec:
- sh
- -ac
- |
{{- if $values.p2pNodePort.enabled }}
. /env/init-nodeport;
{{- end }}
set -ex;
exec arb-node \
--core.checkpoint-gas-frequency=156250000 \
--persistent.chain=/storage \
--persistent.global-config=/storage \
--node.rpc.addr=0.0.0.0 \
--node.rpc.port=9656 \
--node.rpc.tracing.enable \
--node.rpc.enable-l1-calls \
--node.cache.allow-slow-lookup \
--node.rpc.tracing.namespace="trace" \
--node.rpc.enable-l1-calls \
--metrics \
--metrics-server.addr=0.0.0.0 \
{{- range $arg := $values.extraArgs }}
Expand All @@ -180,17 +141,7 @@ spec:
- name: http-jsonrpc
containerPort: 8547
protocol: TCP
- name: udp-p2p
containerPort: {{ include "arbitrum-classic.p2pPort" $values }}
protocol: UDP
- name: tcp-p2p
containerPort: {{ include "arbitrum-classic.p2pPort" $values }}
protocol: TCP
volumeMounts:
{{- if $values.p2pNodePort.enabled }}
- name: env-nodeport
mountPath: /env
{{- end }}
- name: storage
mountPath: /storage
- name: tmp
Expand Down
14 changes: 0 additions & 14 deletions charts/arbitrum-classic/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,17 +143,3 @@ arbitrum:

affinity: {}

p2pNodePort:
# -- Expose P2P port via NodePort
enabled: false
# -- NodePort to be used. Must be unique.
port: 31000
initContainer:
image:
# -- Container image to fetch nodeport information
repository: lachlanevenson/k8s-kubectl
# -- Container tag
tag: v1.25.4
# -- Container pull policy
pullPolicy: IfNotPresent

2 changes: 1 addition & 1 deletion charts/arbitrum-nitro/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.3
version: 0.1.4

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
7 changes: 1 addition & 6 deletions charts/arbitrum-nitro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Deploy and scale [Arbitrum-Nitro](https://github.com/OffchainLabs/nitro/) inside Kubernetes with ease

[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.1.3](https://img.shields.io/badge/Version-0.1.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.0.10-73224e3](https://img.shields.io/badge/AppVersion-v2.0.10--73224e3-informational?style=flat-square)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ![Version: 0.1.4](https://img.shields.io/badge/Version-0.1.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v2.0.10-73224e3](https://img.shields.io/badge/AppVersion-v2.0.10--73224e3-informational?style=flat-square)

## Features

Expand Down Expand Up @@ -97,11 +97,6 @@ We do not recommend that you upgrade the application by overriding `image.tag`.
| nitro.extraArgs | Additional CLI arguments to pass to `nitro` | list | `[]` |
| nitro.extraLabels | Extra labels to attach to the Pod for matching against | object | `{}` |
| nitro.nodeSelector | | object | `{}` |
| nitro.p2pNodePort.enabled | Expose P2P port via NodePort | bool | `false` |
| nitro.p2pNodePort.initContainer.image.pullPolicy | Container pull policy | string | `"IfNotPresent"` |
| nitro.p2pNodePort.initContainer.image.repository | Container image to fetch nodeport information | string | `"lachlanevenson/k8s-kubectl"` |
| nitro.p2pNodePort.initContainer.image.tag | Container tag | string | `"v1.25.4"` |
| nitro.p2pNodePort.port | NodePort to be used. Must be unique. | int | `31000` |
| nitro.podAnnotations | Annotations for the `Pod` | object | `{}` |
| nitro.podSecurityContext | Pod-wide security context | object | `{"fsGroup":101337,"runAsGroup":101337,"runAsNonRoot":true,"runAsUser":101337}` |
| nitro.resources | | object | `{}` |
Expand Down
12 changes: 0 additions & 12 deletions charts/arbitrum-nitro/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,6 @@ Create the name of the service account to use
{{- end }}
{{- end }}

{{- define "arbitrum-nitro.p2pPort" -}}
{{- if .p2pNodePort.enabled }}
{{- print .p2pNodePort.port }}
{{- else }}
{{- printf "30303" -}}
{{- end }}
{{- end -}}

{{- define "arbitrum-nitro.replicas" -}}
{{- if .p2pNodePort.enabled }}
{{- print 1 }}
{{ else }}
{{- default 1 .replicaCount }}
{{- end}}
{{- end -}}
32 changes: 1 addition & 31 deletions charts/arbitrum-nitro/templates/arbitrum-nitro/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,4 @@ spec:
{{- end }}
selector:
{{- include "arbitrum-nitro.selectorLabels" . | nindent 4 }}
{{- $componentLabel | nindent 4 }}
{{- if $values.p2pNodePort.enabled }}
{{- $port := $values.p2pNodePort.port }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ include "arbitrum-nitro.fullname" . }}-p2p-0
labels:
{{- include "arbitrum-nitro.labels" . | nindent 4 }}
{{- $componentLabel | nindent 4 }}
pod: {{ include "arbitrum-nitro.fullname" . }}-0
type: p2p # this label is used by the initContainer to select this service
spec:
type: NodePort
externalTrafficPolicy: Local
ports:
- name: tcp-p2p
port: {{ include "arbitrum-nitro.p2pPort" $values }}
protocol: TCP
targetPort: tcp-p2p
nodePort: {{ $port }}
- name: udp-p2p
port: {{ include "arbitrum-nitro.p2pPort" $values }}
protocol: UDP
targetPort: udp-p2p
nodePort: {{ $port }}
selector:
{{- include "arbitrum-nitro.selectorLabels" . | nindent 4 }}
statefulset.kubernetes.io/pod-name: "{{ include "arbitrum-nitro.fullname" $ }}-0"
{{- end }}
{{- $componentLabel | nindent 4 }}
49 changes: 0 additions & 49 deletions charts/arbitrum-nitro/templates/arbitrum-nitro/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,42 +47,6 @@ spec:
volumes:
- name: tmp # this is to provide a writable /tmp even with securityContext.readOnlyRootFilesystem=true
emptyDir: {}
{{- if $values.p2pNodePort.enabled }}
- name: env-nodeport
emptyDir: {}
{{- end }}
initContainers:
{{- if $values.p2pNodePort.enabled }}
- name: init-nodeport
image: "{{ $values.p2pNodePort.initContainer.image.repository }}:{{ $values.p2pNodePort.initContainer.image.tag }}"
imagePullPolicy: {{ $values.p2pNodePort.initContainer.image.pullPolicy }}
securityContext:
runAsNonRoot: false
runAsUser: 0
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
command:
- sh
- -c
- >
set -ex;
export EXTERNAL_PORT=$(kubectl get services {{ include "arbitrum-nitro.fullname" . }}-p2p-0 -o jsonpath='{.spec.ports[0].nodePort}');
export EXTERNAL_IP=$(kubectl get nodes "${NODE_NAME}" -o jsonpath='{.status.addresses[?(@.type=="ExternalIP")].address}');
export EXTERNAL_IP=${EXTERNAL_IP:-$(curl --silent v4.ident.me)};
echo "EXTERNAL_PORT=$EXTERNAL_PORT" > /env/init-nodeport;
echo "EXTERNAL_IP=$EXTERNAL_IP" >> /env/init-nodeport;
cat /env/init-nodeport;
volumeMounts:
- name: env-nodeport
mountPath: /env
{{- end }}
containers:
- name: {{ $componentName }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand All @@ -96,9 +60,6 @@ spec:
- sh
- -ac
- |
{{- if $values.p2pNodePort.enabled }}
. /env/init-nodeport;
{{- end }}
set -ex;
exec nitro \
--persistent.chain=/storage/data \
Expand All @@ -120,17 +81,7 @@ spec:
- name: http-rpc
containerPort: 8547
protocol: TCP
- name: udp-p2p
containerPort: {{ include "arbitrum-nitro.p2pPort" $values }}
protocol: UDP
- name: tcp-p2p
containerPort: {{ include "arbitrum-nitro.p2pPort" $values }}
protocol: TCP
volumeMounts:
{{- if $values.p2pNodePort.enabled }}
- name: env-nodeport
mountPath: /env
{{- end }}
- name: storage
mountPath: /storage
- name: tmp
Expand Down
14 changes: 0 additions & 14 deletions charts/arbitrum-nitro/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,3 @@ nitro:
antiAffinityByHostname: true

affinity: {}

p2pNodePort:
# -- Expose P2P port via NodePort
enabled: false
# -- NodePort to be used. Must be unique.
port: 31000
initContainer:
image:
# -- Container image to fetch nodeport information
repository: lachlanevenson/k8s-kubectl
# -- Container tag
tag: v1.25.4
# -- Container pull policy
pullPolicy: IfNotPresent