mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-13 14:17:54 +00:00
✨ Add persistentstorage
option
This commit is contained in:
parent
a9b598bc41
commit
a33a3467fc
@ -82,6 +82,7 @@ type TapConfig struct {
|
||||
PodRegexStr string `yaml:"regex" default:".*"`
|
||||
Namespaces []string `yaml:"namespaces"`
|
||||
SelfNamespace string `yaml:"selfnamespace" default:"kubeshark"`
|
||||
PersistentStorage bool `yaml:"persistentstorage" default:"false"`
|
||||
StorageLimit string `yaml:"storagelimit" default:"200Mi"`
|
||||
StorageClass string `yaml:"storageclass" default:"standard"`
|
||||
DryRun bool `yaml:"dryrun" default:"false"`
|
||||
|
@ -67,8 +67,6 @@ spec:
|
||||
- mountPath: /sys
|
||||
name: sys
|
||||
readOnly: true
|
||||
- mountPath: /app/data
|
||||
name: kubeshark-persistent-volume
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
hostNetwork: true
|
||||
serviceAccountName: kubeshark-service-account
|
||||
@ -85,6 +83,3 @@ spec:
|
||||
- hostPath:
|
||||
path: /sys
|
||||
name: sys
|
||||
- name: kubeshark-persistent-volume
|
||||
persistentVolumeClaim:
|
||||
claimName: kubeshark-persistent-volume-claim
|
||||
|
@ -18,6 +18,7 @@ tap:
|
||||
regex: .*
|
||||
namespaces: []
|
||||
selfnamespace: kubeshark
|
||||
persistentstorage: false
|
||||
storagelimit: 200Mi
|
||||
storageclass: standard
|
||||
dryrun: false
|
||||
|
@ -855,17 +855,22 @@ func (provider *Provider) BuildWorkerDaemonSet(
|
||||
MountPath: PersistentVolumeHostPath,
|
||||
}
|
||||
|
||||
// VolumeMount(s)
|
||||
volumeMounts := []core.VolumeMount{
|
||||
procfsVolumeMount,
|
||||
sysfsVolumeMount,
|
||||
}
|
||||
if config.Config.Tap.PersistentStorage {
|
||||
volumeMounts = append(volumeMounts, persistentVolumeMount)
|
||||
}
|
||||
|
||||
// Containers
|
||||
containers := []core.Container{
|
||||
{
|
||||
Name: podName,
|
||||
Image: podImage,
|
||||
ImagePullPolicy: imagePullPolicy,
|
||||
VolumeMounts: []core.VolumeMount{
|
||||
procfsVolumeMount,
|
||||
sysfsVolumeMount,
|
||||
persistentVolumeMount,
|
||||
},
|
||||
VolumeMounts: volumeMounts,
|
||||
Command: command,
|
||||
Resources: core.ResourceRequirements{
|
||||
Limits: core.ResourceList{
|
||||
@ -887,6 +892,15 @@ func (provider *Provider) BuildWorkerDaemonSet(
|
||||
},
|
||||
}
|
||||
|
||||
// Volume(s)
|
||||
volumes := []core.Volume{
|
||||
procfsVolume,
|
||||
sysfsVolume,
|
||||
}
|
||||
if config.Config.Tap.PersistentStorage {
|
||||
volumes = append(volumes, persistentVolume)
|
||||
}
|
||||
|
||||
// Pod
|
||||
pod := DaemonSetPod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@ -900,11 +914,7 @@ func (provider *Provider) BuildWorkerDaemonSet(
|
||||
ServiceAccountName: ServiceAccountName,
|
||||
HostNetwork: true,
|
||||
Containers: containers,
|
||||
Volumes: []core.Volume{
|
||||
procfsVolume,
|
||||
sysfsVolume,
|
||||
persistentVolume,
|
||||
},
|
||||
Volumes: volumes,
|
||||
DNSPolicy: core.DNSClusterFirstWithHostNet,
|
||||
TerminationGracePeriodSeconds: new(int64),
|
||||
Tolerations: provider.BuildTolerations(),
|
||||
|
@ -3,6 +3,7 @@ package kubernetes
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/kubeshark/kubeshark/config"
|
||||
"github.com/kubeshark/kubeshark/config/configStructs"
|
||||
"github.com/kubeshark/kubeshark/docker"
|
||||
"github.com/rs/zerolog/log"
|
||||
@ -21,6 +22,7 @@ func CreateWorkers(
|
||||
tls bool,
|
||||
debug bool,
|
||||
) error {
|
||||
if config.Config.Tap.PersistentStorage {
|
||||
persistentVolumeClaim, err := kubernetesProvider.BuildPersistentVolumeClaim()
|
||||
if err != nil {
|
||||
return err
|
||||
@ -33,6 +35,7 @@ func CreateWorkers(
|
||||
); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
image := docker.GetWorkerImage()
|
||||
|
||||
|
@ -67,8 +67,6 @@ spec:
|
||||
- mountPath: /sys
|
||||
name: sys
|
||||
readOnly: true
|
||||
- mountPath: /app/data
|
||||
name: kubeshark-persistent-volume
|
||||
dnsPolicy: ClusterFirstWithHostNet
|
||||
hostNetwork: true
|
||||
serviceAccountName: kubeshark-service-account
|
||||
@ -85,6 +83,3 @@ spec:
|
||||
- hostPath:
|
||||
path: /sys
|
||||
name: sys
|
||||
- name: kubeshark-persistent-volume
|
||||
persistentVolumeClaim:
|
||||
claimName: kubeshark-persistent-volume-claim
|
||||
|
Loading…
Reference in New Issue
Block a user