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