Unverified Commit 5480ecf6 authored by Pierre Besson's avatar Pierre Besson Committed by GitHub
Browse files

remove the kubernetes helm chart (#3483)

parent bcb04dd3
Pipeline #147826 passed with stages
in 36 minutes and 32 seconds
name: polkadot
version: 0.2
appVersion: 0.2.0
description: Polkadot Node Implementation
home: https://polkadot.network/
icon: https://polkadot.network/favicon.ico
sources:
- https://github.com/paritytech/polkadot/
maintainers:
- name: Paritytech Devops Team
email: devops-team@parity.io
tillerVersion: ">=2.8.0"
# Polkadot Kubernetes Helm Chart
This [Helm Chart](https://helm.sh/) can be used for deploying containerized
**Polkadot** to a [Kubernetes](https://kubernetes.io/) cluster.
## Prerequisites
- Tested on Kubernetes 1.10.7-gke.6
## Installation
To install the chart with the release name `my-release` into namespace
`my-namespace` from within this directory:
```console
$ helm install --namespace my-namespace --name my-release --values values.yaml ./
```
The command deploys Polkadot on the Kubernetes cluster in the configuration
given in `values.yaml`. When the namespace is omitted it'll be installed in
the default one.
## Removal of the Chart
To uninstall/delete the `my-release` deployment:
```console
$ helm delete --namespace my-namespace my-release
```
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Upgrading
Once the chart is installed and a new version should be deployed helm takes
care of this by
```console
$ helm upgrade --namespace my-namespace --values values.yaml my-release ./
```
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: {{ .Values.GitlabEnvSlug | default .Values.app }}
spec:
selector:
matchLabels:
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
maxUnavailable: 1
# see:
# https://kubernetes.io/docs/tutorials/services/
# https://kubernetes.io/docs/concepts/services-networking/service/
# headless service for rpc
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.app }}-rpc
spec:
ports:
- port: 9933
name: http-rpc
- port: 9944
name: websocket-rpc
selector:
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
sessionAffinity: None
type: ClusterIP
clusterIP: None
---
{{- if .Values.listen_node_port }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.app }}
spec:
ports:
- port: 30333
name: p2p
nodePort: 30333
protocol: TCP
selector:
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
sessionAffinity: None
type: NodePort
# don't route exteral traffic to non-local pods
externalTrafficPolicy: Local
{{- else if .Values.validator.keys }}
{{- $root := . -}}
{{- range until (int .Values.nodes.replicas) }}
---
kind: Service
apiVersion: v1
metadata:
name: {{ $root.Values.app }}-{{ . }}
spec:
selector:
statefulset.kubernetes.io/pod-name: {{ $root.Values.app }}-{{ . }}
ports:
- port: 30333
targetPort: 30333
protocol: TCP
{{- end }}
{{- end }}
{{- if .Values.rbac.enable }}
# service account for polkadot pods themselves
# no permissions for the API are required
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
name: {{ .Values.rbac.name }}
{{- end }}
# https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/
# https://cloud.google.com/kubernetes-engine/docs/concepts/statefulset
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Values.app }}
spec:
selector:
matchLabels:
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
serviceName: {{ .Values.app }}
replicas: {{ .Values.nodes.replicas }}
updateStrategy:
type: RollingUpdate
podManagementPolicy: Parallel
template:
metadata:
labels:
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
spec:
{{- if .Values.rbac.enable }}
serviceAccountName: {{ .Values.rbac.name }}
{{- else }}
serviceAccountName: default
{{- end }}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node
operator: In
values:
- {{ .Values.node_group }}
{{- if .Values.listen_node_port }}
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: "app"
operator: In
values:
- {{ .Values.app }}
topologyKey: "kubernetes.io/hostname"
{{- end }}
terminationGracePeriodSeconds: 300
{{- if .Values.validator.keys }}
volumes:
- name: {{ .Values.app }}-validator-secrets
secret:
secretName: {{ .Values.app }}-secrets
initContainers:
- name: prepare-secrets
image: busybox
command: [ "/bin/sh" ]
args:
- -c
- sed -n -r "s/^${POD_NAME}-key ([^ ]+)$/\1/p" /etc/validator/secrets > {{ .Values.image.basepath }}/key;
sed -n -r "s/^${POD_NAME}-node-key ([^ ]+)$/\1/p" /etc/validator/secrets > {{ .Values.image.basepath }}/node-key;
sed -n -r "s/^${POD_NAME}-name ([^ ]+)$/\1/p" /etc/validator/secrets > {{ .Values.image.basepath }}/name;
test -s {{ .Values.image.basepath }}/name || echo "${POD_NAME}" > {{ .Values.image.basepath }}/name
env:
# from (workaround for hostname)
# https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: {{ .Values.app }}-validator-secrets
readOnly: true
mountPath: "/etc/validator"
- name: {{ .Values.app }}dir
mountPath: {{ .Values.image.basepath }}
{{- end }}
containers:
- name: {{ .Values.app }}
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- if .Values.resources }}
resources:
requests:
memory: {{ .Values.resources.memory }}
cpu: {{ .Values.resources.cpu }}
{{- end }}
ports:
- containerPort: 30333
name: p2p
- containerPort: 9933
name: http-rpc
- containerPort: 9944
name: websocket-rpc
command: ["/bin/sh"]
args:
- -c
- exec {{ .Values.image.executable }}
--base-path {{ .Values.image.basepath }}
{{- if .Values.validator.keys }}
--validator
--name $(cat {{ .Values.image.basepath }}/name)
--key $(cat {{ .Values.image.basepath }}/key)
--node-key $(cat {{ .Values.image.basepath }}/node-key)
{{- else }}
--name $(POD_NAME)
{{- end }}
{{- range .Values.nodes.args }} {{ . }} {{- end }}
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: {{ .Values.app }}dir
mountPath: {{ .Values.image.basepath }}
readinessProbe:
httpGet:
path: /health
port: http-rpc
initialDelaySeconds: 10
periodSeconds: 10
livenessProbe:
httpGet:
path: /health
port: http-rpc
initialDelaySeconds: 10
periodSeconds: 10
securityContext:
runAsUser: 1000
fsGroup: 1000
volumeClaimTemplates:
- metadata:
name: {{ .Values.app }}dir
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: ssd
resources:
requests:
storage: 32Gi
# set tag manually --set image.tag=latest
image:
repository: parity/polkadot
tag: latest
pullPolicy: Always
basepath: /polkadot
executable: /usr/local/bin/polkadot
# if set to true a service account for polkadot will be created
rbac:
enable: true
name: polkadot
# name of the statefulset
app: polkadot
node_group: polkadot
listen_node_port: true
nodes:
replicas: 2
args:
- --chain
- alexander
# serve rpc within the local network
# - fenced off the world via firewall
# - used for health checks
- --rpc-external
- --ws-external
# - --log
# - sub-libp2p=trace
validator: {}
# providing 'keys' string via --set commandline parameter will run the nodes
# in validator mode (--validator).
# maybe adopt resource limits here to the nodes of the pool
# resources:
# memory: "5Gi"
# cpu: "1.5"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment