Skip to content

Commit 544d21c

Browse files
Merge pull request #2 from FireTail-io/dev
dev->main
2 parents 98f5d9b + 7e2d446 commit 544d21c

19 files changed

+728
-182
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ dev: build-dev
2222
-e FIRETAIL_API_TOKEN=${FIRETAIL_API_TOKEN} \
2323
-e FIRETAIL_KUBERNETES_SENSOR_DEV_MODE=true \
2424
-e FIRETAIL_KUBERNETES_SENSOR_DEV_SERVER_ENABLED=true \
25+
-e DISABLE_SERVICE_IP_FILTERING=true \
2526
firetail/kubernetes-sensor-dev

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@ POC for a FireTail Kubernetes Sensor.
1010
| ----------------------------------------------- | --------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
1111
| `FIRETAIL_API_TOKEN` || `PS-02-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX-XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX` | The API token the sensor will use to report logs to FireTail |
1212
| `BPF_EXPRESSION` || `tcp and (port 80 or port 443)` | The BPF filter used by the sensor. See docs for syntax info: https://www.tcpdump.org/manpages/pcap-filter.7.html |
13+
| `DISABLE_SERVICE_IP_FILTERING` || `true` | Disables polling Kubernetes for the IP addresses of services & subsequently ignoring all requests captured that aren't made to one of those IPs. |
1314
| `FIRETAIL_API_URL` || `https://api.logging.eu-west-1.prod.firetail.app/logs/bulk` | The API url the sensor will send logs to. Defaults to the EU region production environment. |
14-
| `FIRETAIL_KUBERNETES_SENSOR_DEV_MODE` || `true` | Enables debug logging when set to `true`. |
15+
| `FIRETAIL_KUBERNETES_SENSOR_DEV_MODE` || `true` | Enables debug logging when set to `true`, and reduces the max age of a log in a batch to be sent to FireTail. |
1516
| `FIRETAIL_KUBERNETES_SENSOR_DEV_SERVER_ENABLED` || `true` | Enables a demo web server when set to `true`; useful for sending test requests to. |
1617

1718

1819

19-
20-
2120
## Dev Quickstart
2221

2322
Clone the repo, make a `.env` file with your API token in it, then use the `dev` target in [the provided makefile](./Makefile):
@@ -54,5 +53,10 @@ ftauth
5453
make publish VERSION=latest
5554
```
5655

57-
[Kubernetes sensor docker repository link](https://github.com/firetail-io/firetail-kubernetes-sensor/pkgs/container/kubernetes-sensor)
5856

57+
58+
## Publishing to GHCR
59+
60+
Publishing to GHCR is done via GitHub actions found in [./.github/workflows](./.github/workflows).
61+
62+
You can find the images published here: [github.com/firetail-io/firetail-kubernetes-sensor/pkgs/container/kubernetes-sensor](https://github.com/firetail-io/firetail-kubernetes-sensor/pkgs/container/kubernetes-sensor)

helm/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```bash
2+
helm install firetail-sensor-helm firetail-sensor/ --set apiKey="example"
3+
```

helm/firetail-sensor/.helmignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/

helm/firetail-sensor/Chart.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v2
2+
name: firetail-sensor
3+
description: A Helm chart for Kubernetes
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18+
version: 0.1.0
19+
20+
# This is the version number of the application being deployed. This version number should be
21+
# incremented each time you make changes to the application. Versions are not expected to
22+
# follow Semantic Versioning. They should reflect the version the application is using.
23+
# It is recommended to use it with quotes.
24+
appVersion: "1.16.0"

helm/firetail-sensor/templates/NOTES.txt

Whitespace-only changes.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{{/*
2+
Expand the name of the chart.
3+
*/}}
4+
{{- define "firetail-sensor.name" -}}
5+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6+
{{- end }}
7+
8+
{{/*
9+
Create a default fully qualified app name.
10+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11+
If release name contains chart name it will be used as a full name.
12+
*/}}
13+
{{- define "firetail-sensor.fullname" -}}
14+
{{- if .Values.fullnameOverride }}
15+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16+
{{- else }}
17+
{{- $name := default .Chart.Name .Values.nameOverride }}
18+
{{- if contains $name .Release.Name }}
19+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
20+
{{- else }}
21+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22+
{{- end }}
23+
{{- end }}
24+
{{- end }}
25+
26+
{{/*
27+
Create chart name and version as used by the chart label.
28+
*/}}
29+
{{- define "firetail-sensor.chart" -}}
30+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
31+
{{- end }}
32+
33+
{{/*
34+
Common labels
35+
*/}}
36+
{{- define "firetail-sensor.labels" -}}
37+
helm.sh/chart: {{ include "firetail-sensor.chart" . }}
38+
{{ include "firetail-sensor.selectorLabels" . }}
39+
{{- if .Chart.AppVersion }}
40+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
41+
{{- end }}
42+
app.kubernetes.io/managed-by: {{ .Release.Service }}
43+
{{- end }}
44+
45+
{{/*
46+
Selector labels
47+
*/}}
48+
{{- define "firetail-sensor.selectorLabels" -}}
49+
app.kubernetes.io/name: {{ include "firetail-sensor.name" . }}
50+
app.kubernetes.io/instance: {{ .Release.Name }}
51+
{{- end }}
52+
53+
{{/*
54+
Create the name of the service account to use
55+
*/}}
56+
{{- define "firetail-sensor.serviceAccountName" -}}
57+
{{- if .Values.serviceAccount.create }}
58+
{{- default (include "firetail-sensor.fullname" .) .Values.serviceAccount.name }}
59+
{{- else }}
60+
{{- default "default" .Values.serviceAccount.name }}
61+
{{- end }}
62+
{{- end }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: firetail-api-token-secret
5+
namespace: {{ .Values.namespace }}
6+
type: Opaque
7+
data:
8+
api-key: {{ .Values.apiKey | b64enc | quote }}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: {{ .Release.Name }}-daemonset
5+
namespace: {{ .Values.namespace }}
6+
labels:
7+
app: {{ .Chart.Name }}
8+
release: {{ .Release.Name }}
9+
spec:
10+
selector:
11+
matchLabels:
12+
app: {{ .Chart.Name }}
13+
release: {{ .Release.Name }}
14+
template:
15+
metadata:
16+
labels:
17+
app: {{ .Chart.Name }}
18+
release: {{ .Release.Name }}
19+
annotations:
20+
{{- toYaml .Values.podAnnotations | nindent 8 }}
21+
spec:
22+
serviceAccountName: {{ .Release.Name }}-sa
23+
hostNetwork: true
24+
containers:
25+
- name: firetail-kubernetes-sensor
26+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
27+
imagePullPolicy: {{ .Values.image.pullPolicy }}
28+
env:
29+
- name: "FIRETAIL_API_TOKEN"
30+
valueFrom:
31+
secretKeyRef:
32+
name: "firetail-api-token-secret"
33+
key: "api-key"
34+
{{- range $key, $value := .Values.env }}
35+
- name: "{{ $key }}"
36+
value: "{{ $value }}"
37+
{{- end }}
38+
resources:
39+
{{- toYaml .Values.resources | nindent 12 }}
40+
securityContext:
41+
{{- toYaml .Values.securityContext | nindent 12 }}
42+
volumeMounts:
43+
- name: lib-modules
44+
mountPath: /lib/modules
45+
- name: usr-src
46+
mountPath: /usr/src
47+
volumes:
48+
- name: lib-modules
49+
hostPath:
50+
path: /lib/modules
51+
- name: usr-src
52+
hostPath:
53+
path: /usr/src
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: {{ .Values.namespace }}

0 commit comments

Comments
 (0)