Ci update names and chart (#2076)

* add option to specifiy substrate node name via environment variable file

* gitlab-ci: change job names and adopt to polkadot pipeline

* upgrade helm chart

Signed-off-by: gabriel <gabriel@parity.io>
This commit is contained in:
gabriel klawitter
2019-03-22 13:13:37 +01:00
committed by GitHub
parent 000e7a8002
commit 53f40c583d
8 changed files with 142 additions and 79 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
name: substrate
version: 0.1
version: 0.2
appVersion: 0.9.1
description: "Substrate: The platform for blockchain innovators"
home: https://substrate.network/
@@ -1,10 +1,10 @@
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
metadata:
name: substrate
name: {{ .Values.GitlabEnvSlug | default .Values.app }}
spec:
selector:
matchLabels:
app: substrate
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
maxUnavailable: 1
@@ -2,9 +2,9 @@
apiVersion: v1
kind: Secret
metadata:
name: substrate-secrets
name: {{ .Values.app }}-secrets
labels:
app: substrate
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
type: Opaque
data:
secrets: {{ .Values.validator.keys | default "" }}
@@ -5,9 +5,7 @@
apiVersion: v1
kind: Service
metadata:
name: substrate-rpc
labels:
app: substrate
name: {{ .Values.app }}-rpc
spec:
ports:
- port: 9933
@@ -15,15 +13,16 @@ spec:
- port: 9944
name: websocket-rpc
selector:
app: substrate
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
sessionAffinity: None
type: ClusterIP
clusterIP: None
---
{{- if .Values.listen_node_port }}
apiVersion: v1
kind: Service
metadata:
name: substrate
name: {{ .Values.app }}
spec:
ports:
- port: 30333
@@ -31,9 +30,27 @@ spec:
nodePort: 30333
protocol: TCP
selector:
app: substrate
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 }}
{{- end }}
@@ -5,6 +5,6 @@ apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app: substrate
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
name: {{ .Values.rbac.name }}
{{- end }}
@@ -3,12 +3,12 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: substrate
name: {{ .Values.app }}
spec:
selector:
matchLabels:
app: substrate
serviceName: substrate
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
serviceName: {{ .Values.app }}
replicas: {{ .Values.nodes.replicas }}
updateStrategy:
type: RollingUpdate
@@ -16,7 +16,7 @@ spec:
template:
metadata:
labels:
app: substrate
app: {{ .Values.GitlabEnvSlug | default .Values.app }}
spec:
{{- if .Values.rbac.enable }}
serviceAccountName: {{ .Values.rbac.name }}
@@ -32,6 +32,7 @@ spec:
operator: In
values:
- substrate
{{- if .Values.listen_node_port }}
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
@@ -39,14 +40,15 @@ spec:
- key: "app"
operator: In
values:
- substrate
- {{ .Values.app }}
topologyKey: "kubernetes.io/hostname"
{{- end }}
terminationGracePeriodSeconds: 300
{{- if .Values.validator.keys }}
volumes:
- name: substrate-validator-secrets
- name: {{ .Values.app }}-validator-secrets
secret:
secretName: substrate-secrets
secretName: {{ .Values.app }}-secrets
initContainers:
- name: prepare-secrets
image: busybox
@@ -54,7 +56,9 @@ spec:
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}-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 -z {{ .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/
@@ -63,14 +67,14 @@ spec:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: substrate-validator-secrets
- name: {{ .Values.app }}-validator-secrets
readOnly: true
mountPath: "/etc/validator"
- name: substratedir
- name: {{ .Values.app }}dir
mountPath: {{ .Values.image.basepath }}
{{- end }}
containers:
- name: substrate
- name: {{ .Values.app }}
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
{{- if .Values.resources }}
@@ -91,13 +95,13 @@ spec:
- -c
- exec /usr/local/bin/substrate
--base-path {{ .Values.image.basepath }}
--name $(POD_NAME)
{{- if .Values.validator.enable }}
--validator
{{- end }}
{{- 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:
@@ -106,7 +110,7 @@ spec:
fieldRef:
fieldPath: metadata.name
volumeMounts:
- name: substratedir
- name: {{ .Values.app }}dir
mountPath: {{ .Values.image.basepath }}
readinessProbe:
httpGet:
@@ -125,7 +129,7 @@ spec:
fsGroup: 1000
volumeClaimTemplates:
- metadata:
name: substratedir
name: {{ .Values.app }}dir
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: ssd
+10 -4
View File
@@ -12,6 +12,10 @@ rbac:
name: substrate
# name of the statefulset
app: substrate
listen_node_port: true
nodes:
replicas: 2
args:
@@ -29,15 +33,17 @@ nodes:
# - sub-libp2p=trace
validator:
enable: True
# adds --validator commandline option
validator: {}
# providing 'keys' string via --set commandline parameter will run the nodes
# in validator mode (--validator).
#
# key and node-key can be given in a base64 encoded keyfile string (at
# name, key and node-key can be given in a base64 encoded keyfile string (at
# validator.keys) which has the following format:
#
# substrate-0-name <node-name>
# substrate-0-key <key-seed>
# substrate-0-node-key <node-secret-key>
# substrate-1-name <node-name>
# substrate-1-key <key-seed>
# substrate-1-node-key <node-secret-key>
#