Skip to content

Commit

Permalink
make Cassandra work (fixes #2); document that it may take a minute
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredjennings committed May 20, 2021
1 parent ebf9aa9 commit 2db19d3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ helm install -n thehive my-thehive . \
Defaults are for local index storage, local database storage, and
attachment storage, all on Kubernetes persistent volumes.

## Caveats

Upon first installation, TheHive may fail to connect to Cassandra for
a few minutes. Try waiting it out.

## Improving it

If this chart doesn't flex in a way you need it to, and there isn't
Expand Down
19 changes: 19 additions & 0 deletions templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ If release name contains chart name it will be used as a full name.
{{- end }}
{{- end }}

{{/*
Create the name of Cassandra, because it looks like scoping issues prevent us
from using its original definition.
*/}}
{{- define "thehive.cassandra.fullname" -}}
{{- if .Values.cassandra.fullnameOverride }}
{{- .Values.cassandra.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := "cassandra" }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}


{{- define "thehive.cassandra.secretname" -}}
{{ include "thehive.cassandra.fullname" . }}
{{- end }}


{{/*
Name the Play framework secret.
*/}}
Expand Down
3 changes: 2 additions & 1 deletion templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ data:
{{- if .Values.cassandra.enabled }}
backend: cql
# let the Kubernetes Service take care of it
hostname: ['cassandra']
hostname: [ {{ include "thehive.cassandra.fullname" . | quote }} ]
username: "@@CQL_USERNAME@@"
password: "@@CQL_PASSWORD@@"
cql {
Expand Down Expand Up @@ -78,6 +78,7 @@ data:
<!-- <logger name="org.thp.scalligraph.auth" level="TRACE"/> -->
<!-- <logger name="services.UserSrv" level="TRACE" /> -->
<!-- /authentication debugging -->
<logger name="org.janusgraph.diskstorage.cql" level="TRACE"/>
<logger name="com.gargoylesoftware.htmlunit.javascript" level="OFF"/>
<root level="INFO">
<appender-ref ref="ASYNCSTDOUT"/>
Expand Down
9 changes: 6 additions & 3 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ spec:
value: changeit
{{- end }}
- name: ES_USERNAME
valueFrom
value: {{ .Values.elasticsearch.username | quote }}
- name: ES_PASSWORD
valueFrom:
secretKeyRef:
Expand All @@ -102,9 +102,12 @@ spec:
{{- end }}
{{- if .Values.cassandra.enabled }}
- name: CQL_USERNAME
value: notimplementedyet
value: {{ .Values.cassandra.dbUser.user | default "cassandra" | quote }}
- name: CQL_PASSWORD
value: notimplementedyet
valueFrom:
secretKeyRef:
name: {{ include "thehive.cassandra.secretname" . | quote }}
key: "cassandra-password"
{{- end }}
command:
- sh
Expand Down

0 comments on commit 2db19d3

Please sign in to comment.