Unverified Commit 6696c8ef authored by gabriel klawitter's avatar gabriel klawitter Committed by GitHub
Browse files

Ci kubernetes chart update (#187)

* update helm chart from substrate

* ci: change container image to kubetools
parent 8f19f8ab
Pipeline #33992 passed with stages
in 19 minutes and 47 seconds
...@@ -212,7 +212,7 @@ publish-s3-release: ...@@ -212,7 +212,7 @@ publish-s3-release:
when: manual when: manual
cache: {} cache: {}
retry: 1 retry: 1
image: parity/kubectl-helm:$HELM_VERSION image: parity/kubetools:latest
<<: *build-only <<: *build-only
tags: tags:
# this is the runner that is used to deploy it # this is the runner that is used to deploy it
......
name: polkadot name: polkadot
version: 0.1 version: 0.2
appVersion: 0.2.0 appVersion: 0.2.0
description: Polkadot Node Implementation description: Polkadot Node Implementation
home: https://polkadot.network/ home: https://polkadot.network/
......
apiVersion: policy/v1beta1 apiVersion: policy/v1beta1
kind: PodDisruptionBudget kind: PodDisruptionBudget
metadata: metadata:
name: polkadot name: {{ .Values.GitlabEnvSlug | default .Values.app }}
spec: spec:
selector: selector:
matchLabels: matchLabels:
app: polkadot app: {{ .Values.GitlabEnvSlug | default .Values.app }}
maxUnavailable: 1 maxUnavailable: 1
...@@ -5,9 +5,7 @@ ...@@ -5,9 +5,7 @@
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: polkadot-rpc name: {{ .Values.app }}-rpc
labels:
app: polkadot
spec: spec:
ports: ports:
- port: 9933 - port: 9933
...@@ -15,15 +13,16 @@ spec: ...@@ -15,15 +13,16 @@ spec:
- port: 9944 - port: 9944
name: websocket-rpc name: websocket-rpc
selector: selector:
app: polkadot app: {{ .Values.GitlabEnvSlug | default .Values.app }}
sessionAffinity: None sessionAffinity: None
type: ClusterIP type: ClusterIP
clusterIP: None clusterIP: None
--- ---
{{- if .Values.listen_node_port }}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: polkadot name: {{ .Values.app }}
spec: spec:
ports: ports:
- port: 30333 - port: 30333
...@@ -31,9 +30,25 @@ spec: ...@@ -31,9 +30,25 @@ spec:
nodePort: 30333 nodePort: 30333
protocol: TCP protocol: TCP
selector: selector:
app: polkadot app: {{ .Values.GitlabEnvSlug | default .Values.app }}
sessionAffinity: None sessionAffinity: None
type: NodePort type: NodePort
# don't route exteral traffic to non-local pods # don't route exteral traffic to non-local pods
externalTrafficPolicy: Local 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 }}
...@@ -5,8 +5,6 @@ apiVersion: v1 ...@@ -5,8 +5,6 @@ apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
labels: labels:
app: polkadot app: {{ .Values.GitlabEnvSlug | default .Values.app }}
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
release: {{ .Release.Name }}
name: {{ .Values.rbac.name }} name: {{ .Values.rbac.name }}
{{- end }} {{- end }}
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
apiVersion: apps/v1 apiVersion: apps/v1
kind: StatefulSet kind: StatefulSet
metadata: metadata:
name: polkadot name: {{ .Values.app }}
spec: spec:
selector: selector:
matchLabels: matchLabels:
app: polkadot app: {{ .Values.GitlabEnvSlug | default .Values.app }}
serviceName: polkadot serviceName: {{ .Values.app }}
replicas: {{ .Values.nodes.replicas }} replicas: {{ .Values.nodes.replicas }}
updateStrategy: updateStrategy:
type: RollingUpdate type: RollingUpdate
...@@ -16,7 +16,7 @@ spec: ...@@ -16,7 +16,7 @@ spec:
template: template:
metadata: metadata:
labels: labels:
app: polkadot app: {{ .Values.GitlabEnvSlug | default .Values.app }}
spec: spec:
{{- if .Values.rbac.enable }} {{- if .Values.rbac.enable }}
serviceAccountName: {{ .Values.rbac.name }} serviceAccountName: {{ .Values.rbac.name }}
...@@ -31,7 +31,8 @@ spec: ...@@ -31,7 +31,8 @@ spec:
- key: node - key: node
operator: In operator: In
values: values:
- polkadot - {{ .Values.node_group }}
{{- if .Values.listen_node_port }}
podAntiAffinity: podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution: requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector: - labelSelector:
...@@ -39,11 +40,41 @@ spec: ...@@ -39,11 +40,41 @@ spec:
- key: "app" - key: "app"
operator: In operator: In
values: values:
- polkadot - {{ .Values.app }}
topologyKey: "kubernetes.io/hostname" topologyKey: "kubernetes.io/hostname"
{{- end }}
terminationGracePeriodSeconds: 300 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: containers:
- name: polkapod - name: {{ .Values.app }}
imagePullPolicy: "{{ .Values.image.pullPolicy }}" imagePullPolicy: "{{ .Values.image.pullPolicy }}"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- if .Values.resources }} {{- if .Values.resources }}
...@@ -59,40 +90,46 @@ spec: ...@@ -59,40 +90,46 @@ spec:
name: http-rpc name: http-rpc
- containerPort: 9944 - containerPort: 9944
name: websocket-rpc name: websocket-rpc
command: ["/bin/sh"]
args: args:
- --base-path - -c
- {{ .Values.image.basepath }} - exec {{ .Values.image.executable }}
- --name --base-path {{ .Values.image.basepath }}
- $(MY_POD_NAME) {{- if .Values.validator.keys }}
{{- range .Values.nodes.args }} --validator
- {{ . }} --name $(cat {{ .Values.image.basepath }}/name)
{{- end }} --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: env:
# from (workaround for hostname) - name: POD_NAME
# https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/
- name: MY_POD_NAME
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: metadata.name fieldPath: metadata.name
volumeMounts: volumeMounts:
- name: polkadir - name: {{ .Values.app }}dir
mountPath: {{ .Values.image.basepath }} mountPath: {{ .Values.image.basepath }}
readinessProbe: readinessProbe:
tcpSocket: httpGet:
path: /health
port: http-rpc port: http-rpc
initialDelaySeconds: 30 initialDelaySeconds: 10
periodSeconds: 30 periodSeconds: 10
livenessProbe: livenessProbe:
tcpSocket: httpGet:
path: /health
port: http-rpc port: http-rpc
initialDelaySeconds: 30 initialDelaySeconds: 10
periodSeconds: 30 periodSeconds: 10
securityContext: securityContext:
runAsUser: 1000 runAsUser: 1000
fsGroup: 1000 fsGroup: 1000
volumeClaimTemplates: volumeClaimTemplates:
- metadata: - metadata:
name: polkadir name: {{ .Values.app }}dir
spec: spec:
accessModes: [ "ReadWriteOnce" ] accessModes: [ "ReadWriteOnce" ]
storageClassName: ssd storageClassName: ssd
......
...@@ -4,6 +4,7 @@ image: ...@@ -4,6 +4,7 @@ image:
tag: latest tag: latest
pullPolicy: Always pullPolicy: Always
basepath: /polkadot basepath: /polkadot
executable: /usr/local/bin/polkadot
# if set to true a service account for polkadot will be created # if set to true a service account for polkadot will be created
...@@ -11,12 +12,16 @@ rbac: ...@@ -11,12 +12,16 @@ rbac:
enable: true enable: true
name: polkadot name: polkadot
# name of the statefulset
app: polkadot
node_group: polkadot
listen_node_port: true
nodes: nodes:
replicas: 2 replicas: 2
args: args:
- --chain - --chain
- krummelanke - alexander
# serve rpc within the local network # serve rpc within the local network
# - fenced off the world via firewall # - fenced off the world via firewall
# - used for health checks # - used for health checks
...@@ -24,11 +29,11 @@ nodes: ...@@ -24,11 +29,11 @@ nodes:
- --ws-external - --ws-external
# - --log # - --log
# - sub-libp2p=trace # - sub-libp2p=trace
# - --validator
# - --key
# - key_name
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 # maybe adopt resource limits here to the nodes of the pool
# resources: # resources:
......
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