Skip to content

Commit

Permalink
Add initial sawtooth chart
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Marshall <alex@blockchaintp.com>
  • Loading branch information
alexhq committed Apr 22, 2020
1 parent fdeff42 commit f8732b7
Show file tree
Hide file tree
Showing 11 changed files with 947 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/sawtooth/.helmignore
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
21 changes: 21 additions & 0 deletions charts/sawtooth/Chart.yaml
@@ -0,0 +1,21 @@
apiVersion: v2
name: sawtooth
description: A Helm chart for Sawtooth

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
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.
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application.
appVersion: 1.1.5p1
33 changes: 33 additions & 0 deletions charts/sawtooth/templates/200-monitoring-svcs.yaml
@@ -0,0 +1,33 @@
---
apiVersion: v1
kind: Service
metadata:
name: grafana
namespace: {{ .Values.sawtooth.namespace }}
labels:
app: {{ .Values.sawtooth.networkName }}-monitoring
spec:
ports:
- port: 3000
protocol: TCP
targetPort: 3000
name: grafana
selector:
app: {{ .Values.sawtooth.networkName }}-monitoring
---
apiVersion: v1
kind: Service
metadata:
name: influxdb
namespace: {{ .Values.sawtooth.namespace }}
labels:
app: {{ .Values.sawtooth.networkName }}-monitoring
spec:
ports:
- port: 8086
protocol: TCP
targetPort: 8086
name: influxdb
selector:
app: {{ .Values.sawtooth.networkName }}-monitoring
---
41 changes: 41 additions & 0 deletions charts/sawtooth/templates/201-monitoring-cm.yaml
@@ -0,0 +1,41 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: monitoring-cm
namespace: {{ .Values.sawtooth.namespace }}
data:
telegraf.conf: |
[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = ""
debug = false
quiet = false
logfile = ""
hostname = ""
omit_hostname = false
[[outputs.influxdb]]
urls = ["http://influxdb.{{.Values.sawtooth.namespace}}:8086"]
database = "metrics"
precision = "s"
[[inputs.cpu]]
percpu = true
totalcpu = true
collect_cpu_time = false
report_active = false
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "devfs", "overlay", "aufs", "squashfs"]
[[inputs.diskio]]
[[inputs.kernel]]
[[inputs.mem]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]
---
53 changes: 53 additions & 0 deletions charts/sawtooth/templates/210-monitoring-set.yaml
@@ -0,0 +1,53 @@
---
###
# Monitoring consists of
# a) an influxdb database which is targeted by all of the validators
# as well as a telegraf instance on each validator.
# b) a grafana instance which reads from the influxdb
##
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ .Values.sawtooth.networkName }}-monitoring
namespace: {{ .Values.sawtooth.namespace }}
labels:
app: {{ .Values.sawtooth.networkName }}-monitoring
spec:
selector:
matchLabels:
app: {{ .Values.sawtooth.networkName }}-monitoring
serviceName: "{{ .Values.sawtooth.networkName }}-monitoring"
template:
metadata:
labels:
app: {{ .Values.sawtooth.networkName }}-monitoring
spec:
serviceAccountName: {{ .Values.sawtooth.networkName }}-sa
{{ if .Values.imagePullSecrets.enabled }}
imagePullSecrets:
{{ range .Values.imagePullSecrets.value }}
- name: {{ .name }}
{{ end }}
{{ end }}
containers:
- name: influxdb
image: {{ .Values.images.influxdb }}
ports:
- containerPort: 8086
name: influxdb
resources:
limits:
cpu: "100m"
requests:
cpu: "50m"
- name: grafana
image: {{ .Values.images.grafana }}
ports:
- containerPort: 3000
name: grafana
resources:
limits:
cpu: "100m"
requests:
cpu: "50m"
---
56 changes: 56 additions & 0 deletions charts/sawtooth/templates/300-validator-roles.yaml
@@ -0,0 +1,56 @@
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .Values.sawtooth.networkName }}-sa
namespace: {{ .Values.sawtooth.namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: {{ .Values.sawtooth.networkName }}:role
namespace: {{ .Values.sawtooth.namespace }}
rules:
- apiGroups: ["","apps/v1"] # "" refers to the core API group
resources: ["services", "statefulsets.apps","endpoints", "nodes", "pods"]
verbs: ["get", "list", "watch", "patch"]
- apiGroups: ["","apps/v1"] # "" refers to the core API group
resources: ["configmaps"]
verbs: ["get", "create", "list", "watch", "patch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ .Values.sawtooth.namespace }}:{{ .Values.sawtooth.networkName }}:clusterrole
rules:
- apiGroups: ["","apps/v1"] # "" refers to the core API group
resources: ["statefulsets.apps", "nodes", "pods"]
verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: {{ .Values.sawtooth.namespace }}:{{ .Values.sawtooth.networkName }}
namespace: {{ .Values.sawtooth.namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: {{ .Values.sawtooth.networkName }}:role
subjects:
- kind: ServiceAccount
name: {{ .Values.sawtooth.networkName }}-sa
namespace: {{ .Values.sawtooth.namespace }}
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: {{ .Values.sawtooth.namespace }}:{{ .Values.sawtooth.networkName }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ .Values.sawtooth.namespace }}:{{ .Values.sawtooth.networkName }}:clusterrole
subjects:
- kind: ServiceAccount
name: {{ .Values.sawtooth.networkName }}-sa
namespace: {{ .Values.sawtooth.namespace }}
---
62 changes: 62 additions & 0 deletions charts/sawtooth/templates/310-validators-svcs.yaml
@@ -0,0 +1,62 @@
{{$peering:= .Values.sawtooth.dynamicpeering}}
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.sawtooth.networkName }}-rest-api
namespace: {{ .Values.sawtooth.namespace }}
labels:
app: {{ .Values.sawtooth.networkName }}-validator
spec:
sessionAffinity: ClientIP
ports:
- port: 8008
protocol: TCP
targetPort: 8008
name: rest-api
{{ if .Values.sawtooth.seth.enabled }}
- port: 3030
protocol: TCP
targetPort: 3030
name: seth-rpc
{{ end }}
selector:
app: {{ .Values.sawtooth.networkName }}-validator
---
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.sawtooth.networkName }}-validator
namespace: {{ .Values.sawtooth.namespace }}
labels:
app: {{ .Values.sawtooth.networkName }}-validator
spec:
type: ClusterIP
clusterIP: None
ports:
- port: 8800
protocol: TCP
targetPort: 8800
name: sawnet
selector:
app: {{ .Values.sawtooth.networkName }}-validator
---
{{ if .Values.sawtooth.xo.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.sawtooth.networkName }}-xo-demo
namespace: {{.Values.sawtooth.namespace}}
labels:
app: {{ .Values.sawtooth.networkName }}-xo-demo
spec:
sessionAffinity: ClientIP
ports:
- port: 80
protocol: TCP
targetPort: 80
name: xo-demo
selector:
app: {{ .Values.sawtooth.networkName }}-validator
---
{{ end }}

0 comments on commit f8732b7

Please sign in to comment.