Skip to content

Commit

Permalink
feat: adding casspoke
Browse files Browse the repository at this point in the history
  • Loading branch information
deimosfr committed Oct 21, 2018
1 parent 7dcbd4c commit 8038dc4
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea
tests/.vagrant
dind-cluster-*
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ language: go
sudo: required

env:
- K8S_VERSION=1.9 HELM_VERSION=2.9.1 NUM_NODES=3 SKIP_SNAPSHOT=y PATH="$HOME/.kubeadm-dind-cluster:/tmp/linux-amd64:$PATH"
- K8S_VERSION=1.8 HELM_VERSION=2.9.1 NUM_NODES=3 SKIP_SNAPSHOT=y PATH="$HOME/.kubeadm-dind-cluster:/tmp/linux-amd64:$PATH"

install:
Expand All @@ -17,4 +16,4 @@ script:
- bats -t tests/states/delete.bats

after_script:
- tests/k8s-euft/clean_k8s.sh
- tests/k8s-euft/clean_k8s.sh
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

You can find here a helm chart we're using at [MySocialApp](https://mysocialapp.io)

This is a Kubernetes Helm Chart for Cassandra.
This is a Kubernetes Helm Chart for Cassandra with several useful monitoring and management tools.

## Backups

Expand Down Expand Up @@ -94,6 +94,18 @@ cassandraAlertmanager:
And adapt alert labels to you configuration.
## Casspoke
[Casspoke](https://github.com/criteo/casspoke) is a latency probe checker for Cassandra. To enable it:
```yaml
# Casspoke
casspoke:
enablePoke: true
```
Update as well other settings if you need.
# FAQ
## How to replace a Node?
Expand Down
27 changes: 27 additions & 0 deletions kubernetes/templates/cassPokeConfigmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{{- if .Values.casspoke.enablePoke }}
kind: ConfigMap
apiVersion: v1
metadata:
name: casspoke
namespace: {{ .Release.Namespace }}
labels:
app: casspoke
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
data:
config.yml: |-
app:
measurementPeriodInSec: 10
refreshDiscoveryPeriodInSec: 60
httpServerPort: {{ .Values.casspoke.config.httpServerPort }}
discovery:
staticDns:
clustername: {{ .Values.casspoke.config.clustername }}
host: {{ .Values.casspoke.config.host }}
service:
type: CassandraRunner
timeoutInSec: 60
{{- end }}
51 changes: 51 additions & 0 deletions kubernetes/templates/casspokeDeploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{- if .Values.casspoke.enablePoke }}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: casspoke
namespace: {{ .Release.Namespace }}
labels:
app: casspoke
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
replicas: {{ .Values.casspoke.replicaCount }}
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
template:
metadata:
labels:
app: casspoke
spec:
nodeSelector:
{{- range $key, $val := .Values.casspoke.nodeSelector }}
{{ $key }}: {{ $val | quote }}
{{- end}}
containers:
- name: casspoke
image: "quay.io/deimosfr/casspoke:{{ .Values.casspoke.imageVersion }}"
env:
- name: JVM_OPTS
value: {{ .Values.casspoke.envVariables.JVM_OPTS }}
ports:
- name: metrics
containerPort: {{ .Values.casspoke.config.httpServerPort }}
protocol: TCP
livenessProbe:
tcpSocket:
port: {{ .Values.casspoke.config.httpServerPort }}
initialDelaySeconds: 60
periodSeconds: 10
resources:
{{ toYaml .Values.casspoke.resources | indent 10 }}
volumeMounts:
- name: casspoke
mountPath: /etc/casspoke
volumes:
- name: casspoke
configMap:
name: casspoke
{{- end }}
21 changes: 21 additions & 0 deletions kubernetes/templates/casspokeService.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.casspoke.enablePoke }}
apiVersion: v1
kind: Service
metadata:
name: casspoke
namespace: {{ .Release.Namespace }}
labels:
app: casspoke
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
clusterIP: None
ports:
- name: metrics
port: 80
targetPort: {{ .Values.casspoke.config.httpServerPort }}
protocol: TCP
selector:
app: casspoke
{{- end }}
21 changes: 21 additions & 0 deletions kubernetes/templates/casspokeServicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if .Values.casspoke.enablePoke }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: casspoke-{{ .Release.Namespace }}
namespace: observability
labels:
app: casspoke
prometheus: observability
spec:
selector:
matchLabels:
app: casspoke
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
endpoints:
- port: metrics
interval: 60s
scrapeTimeout: 59s
{{- end }}
21 changes: 21 additions & 0 deletions kubernetes/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,27 @@ cassandraExporter:
listenPort: 8080
jvmOpts: ""

# Casspoke
casspoke:
enablePoke: false
imageVersion: 1.2
replicaCount: 3
nodeSelector:
node-role.kubernetes.io/node: "true"
config:
httpServerPort: 8080
clustername: cassandra
host: cassandra-0.cassandra:9042,cassandra-1.cassandra:9042,cassandra-2.cassandra:9042
envVariables:
JVM_OPTS: "-XX:+UnlockExperimentalVMOptions -XX:MaxRAMFraction=2 -XX:+AlwaysPreTouch"
resources:
limits:
cpu: 300m
memory: 500Mi
requests:
cpu: 300m
memory: 500Mi

# Prometheus scraping
cassandraPrometheusScrap:
enableScrap: false
Expand Down
4 changes: 4 additions & 0 deletions tests/states/deploy.bats
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@ load common
@test "Check all Cassandra nodes are Up and Normal" {
num_nodes_eq_nodetool_status_un
}

@test "Upgrade test" {
helm upgrade kubernetes -n cassandra
}

0 comments on commit 8038dc4

Please sign in to comment.