From 30834d39ba66f3f2c65debf43d200b92cfe88d16 Mon Sep 17 00:00:00 2001 From: Serhiy Berezin Date: Wed, 29 Nov 2023 21:59:50 +0100 Subject: [PATCH] EFS persistent volume docs/14 EFS static and dynamic provision added to default --- cmd/tap.go | 2 ++ config/configStructs/tapConfig.go | 4 ++++ helm-chart/README.md | 2 ++ .../templates/08-persistent-volume-claim.yaml | 21 +++++++++++++++++++ helm-chart/values.yaml | 2 ++ 5 files changed, 31 insertions(+) diff --git a/cmd/tap.go b/cmd/tap.go index 038bca055..0f9f8a8f1 100644 --- a/cmd/tap.go +++ b/cmd/tap.go @@ -50,6 +50,8 @@ func init() { tapCmd.Flags().StringSliceP(configStructs.NamespacesLabel, "n", defaultTapConfig.Namespaces, "Namespaces selector") tapCmd.Flags().StringP(configStructs.ReleaseNamespaceLabel, "s", defaultTapConfig.Release.Namespace, "Release namespace of Kubeshark") tapCmd.Flags().Bool(configStructs.PersistentStorageLabel, defaultTapConfig.PersistentStorage, "Enable persistent storage (PersistentVolumeClaim)") + tapCmd.Flags().Bool(configStructs.PersistentStorageStaticLabel, defaultTapConfig.PersistentStorageStatic, "Persistent storage static provision") + tapCmd.Flags().Bool(configStructs.EfsFileSytemIdAndPathLabel, defaultTapConfig.EfsFileSytemIdAndPath, "EFS file system ID") tapCmd.Flags().String(configStructs.StorageLimitLabel, defaultTapConfig.StorageLimit, "Override the default storage limit (per node)") tapCmd.Flags().String(configStructs.StorageClassLabel, defaultTapConfig.StorageClass, "Override the default storage class of the PersistentVolumeClaim (per node)") tapCmd.Flags().Bool(configStructs.DryRunLabel, defaultTapConfig.DryRun, "Preview of all pods matching the regex, without tapping them") diff --git a/config/configStructs/tapConfig.go b/config/configStructs/tapConfig.go index f0f72bf38..872da31a1 100644 --- a/config/configStructs/tapConfig.go +++ b/config/configStructs/tapConfig.go @@ -31,6 +31,8 @@ const ( DebugLabel = "debug" ContainerPort = 80 ContainerPortStr = "80" + PersistentStorageStaticLabel = "persistentStorageStatic" + EfsFileSytemIdAndPathLabel = "efsFileSytemIdAndPath" ) type ResourceLimits struct { @@ -128,6 +130,8 @@ type TapConfig struct { Debug bool `yaml:"debug" json:"debug" default:"false"` NoKernelModule bool `yaml:"noKernelModule" json:"noKernelModule" default:"false"` Telemetry TelemetryConfig `yaml:"telemetry" json:"telemetry"` + PersistentStorageStatic bool `yaml:"persistentStorageStatic" json:"persistentStorageStatic" default:"false"` + EfsFileSytemIdAndPath bool `yaml:"efsFileSytemIdAndPath" json:"efsFileSytemIdAndPath" default:""` } func (config *TapConfig) PodRegex() *regexp.Regexp { diff --git a/helm-chart/README.md b/helm-chart/README.md index f71f2d7fe..f2c325b5a 100644 --- a/helm-chart/README.md +++ b/helm-chart/README.md @@ -122,6 +122,8 @@ helm install kubeshark kubeshark/kubeshark \ | `tap.release.name` | Helm release name | `kubeshark` | | `tap.release.namespace` | Helm release namespace | `default` | | `tap.persistentStorage` | Use `persistentVolumeClaim` instead of `emptyDir` | `false` | +| `tap.persistentStorageStatic` | Use static persistent volume provisioning (explicitly defined `PersistentVolume` ) | `false` | +| `tap.efsFileSytemIdAndPath` | [EFS file system ID and, optionally, subpath and/or access point](https://github.com/kubernetes-sigs/aws-efs-csi-driver/blob/master/examples/kubernetes/access_points/README.md) `::` | "" | | `tap.storageLimit` | Limit of either the `emptyDir` or `persistentVolumeClaim` | `500Mi` | | `tap.storageClass` | Storage class of the `PersistentVolumeClaim` | `standard` | | `tap.dryRun` | Preview of all pods matching the regex, without tapping them | `false` | diff --git a/helm-chart/templates/08-persistent-volume-claim.yaml b/helm-chart/templates/08-persistent-volume-claim.yaml index ef0935ebf..15d17e53a 100644 --- a/helm-chart/templates/08-persistent-volume-claim.yaml +++ b/helm-chart/templates/08-persistent-volume-claim.yaml @@ -1,4 +1,25 @@ --- +{{- if .Values.tap.persistentStorageStatic }} +apiVersion: v1 +kind: PersistentVolume +metadata: + name: kubeshark-persistent-volume-claim + namespace: {{ .Release.Namespace }} +spec: + capacity: + storage: {{ .Values.tap.storageLimit }} + volumeMode: Filesystem + accessModes: + - ReadWriteMany + persistentVolumeReclaimPolicy: Retain + storageClassName: {{ .Values.tap.storageClass }} + {{- if .Values.tap.efsFileSytemIdAndPath }} + csi: + driver: efs.csi.aws.com + volumeHandle: {{ .Values.tap.efsFileSytemIdAndPath }} + {{ end }} +--- +{{ end }} {{- if .Values.tap.persistentStorage }} apiVersion: v1 kind: PersistentVolumeClaim diff --git a/helm-chart/values.yaml b/helm-chart/values.yaml index 521961a88..f6fcdf6d3 100644 --- a/helm-chart/values.yaml +++ b/helm-chart/values.yaml @@ -20,6 +20,8 @@ tap: name: kubeshark namespace: default persistentStorage: false + persistentStorageStatic: false + efsFileSytemIdAndPathLabel: "" storageLimit: 500Mi storageClass: standard dryRun: false