diff --git a/api/v1alpha1/humiocluster_types.go b/api/v1alpha1/humiocluster_types.go index 85bc1ff6..4c897ebd 100644 --- a/api/v1alpha1/humiocluster_types.go +++ b/api/v1alpha1/humiocluster_types.go @@ -18,6 +18,7 @@ package v1alpha1 import ( corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" ) @@ -256,6 +257,14 @@ type HumioNodeSpec struct { // HumioNodePoolFeatures defines the features that are allowed by the node pool NodePoolFeatures HumioNodePoolFeatures `json:"nodePoolFeatures,omitempty"` + + // SharedVolumeStorageMedium allows overriding the default storage medium of the shared volume used to share + // information between the init and humio containers + SharedVolumeStorageMedium corev1.StorageMedium `json:"sharedVolumeStorageMedium,omitempty"` + + // SharedVolumeStorageSizeLimit allows overriding the default size limit of the shared volume used to share + // information between the init and humio containers + SharedVolumeStorageSizeLimit *resource.Quantity `json:"sharedVolumeStorageSizeLimit,omitempty"` } type HumioNodePoolFeatures struct { diff --git a/charts/humio-operator/crds/core.humio.com_humioclusters.yaml b/charts/humio-operator/crds/core.humio.com_humioclusters.yaml index 0a6cbf64..68b03a1c 100644 --- a/charts/humio-operator/crds/core.humio.com_humioclusters.yaml +++ b/charts/humio-operator/crds/core.humio.com_humioclusters.yaml @@ -11488,6 +11488,20 @@ spec: process. This should not be enabled, unless you need this for debugging purposes. https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/ type: boolean + sharedVolumeStorageMedium: + description: |- + SharedVolumeStorageMedium allows overriding the default storage medium of the shared volume used to share + information between the init and humio containers + type: string + sharedVolumeStorageSizeLimit: + anyOf: + - type: integer + - type: string + description: |- + SharedVolumeStorageSizeLimit allows overriding the default size limit of the shared volume used to share + information between the init and humio containers + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true sidecarContainer: description: |- SidecarContainers can be used in advanced use-cases where you want one or more sidecar container added to the @@ -13402,6 +13416,20 @@ spec: process. This should not be enabled, unless you need this for debugging purposes. https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/ type: boolean + sharedVolumeStorageMedium: + description: |- + SharedVolumeStorageMedium allows overriding the default storage medium of the shared volume used to share + information between the init and humio containers + type: string + sharedVolumeStorageSizeLimit: + anyOf: + - type: integer + - type: string + description: |- + SharedVolumeStorageSizeLimit allows overriding the default size limit of the shared volume used to share + information between the init and humio containers + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true sidecarContainer: description: |- SidecarContainers can be used in advanced use-cases where you want one or more sidecar container added to the diff --git a/config/crd/bases/core.humio.com_humioclusters.yaml b/config/crd/bases/core.humio.com_humioclusters.yaml index 0a6cbf64..68b03a1c 100644 --- a/config/crd/bases/core.humio.com_humioclusters.yaml +++ b/config/crd/bases/core.humio.com_humioclusters.yaml @@ -11488,6 +11488,20 @@ spec: process. This should not be enabled, unless you need this for debugging purposes. https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/ type: boolean + sharedVolumeStorageMedium: + description: |- + SharedVolumeStorageMedium allows overriding the default storage medium of the shared volume used to share + information between the init and humio containers + type: string + sharedVolumeStorageSizeLimit: + anyOf: + - type: integer + - type: string + description: |- + SharedVolumeStorageSizeLimit allows overriding the default size limit of the shared volume used to share + information between the init and humio containers + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true sidecarContainer: description: |- SidecarContainers can be used in advanced use-cases where you want one or more sidecar container added to the @@ -13402,6 +13416,20 @@ spec: process. This should not be enabled, unless you need this for debugging purposes. https://kubernetes.io/docs/tasks/configure-pod-container/share-process-namespace/ type: boolean + sharedVolumeStorageMedium: + description: |- + SharedVolumeStorageMedium allows overriding the default storage medium of the shared volume used to share + information between the init and humio containers + type: string + sharedVolumeStorageSizeLimit: + anyOf: + - type: integer + - type: string + description: |- + SharedVolumeStorageSizeLimit allows overriding the default size limit of the shared volume used to share + information between the init and humio containers + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true sidecarContainer: description: |- SidecarContainers can be used in advanced use-cases where you want one or more sidecar container added to the diff --git a/controllers/humiocluster_defaults.go b/controllers/humiocluster_defaults.go index df5bafc6..8ff3e52f 100644 --- a/controllers/humiocluster_defaults.go +++ b/controllers/humiocluster_defaults.go @@ -23,6 +23,7 @@ import ( "strings" "github.com/humio/humio-operator/pkg/kubernetes" + "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/util/intstr" @@ -769,6 +770,14 @@ func (hnp *HumioNodePool) GetHumioServiceLabels() map[string]string { return hnp.humioNodeSpec.HumioServiceLabels } +func (hnp *HumioNodePool) GetSharedVolumeStorageMedium() corev1.StorageMedium { + return hnp.humioNodeSpec.SharedVolumeStorageMedium +} + +func (hnp *HumioNodePool) GetSharedVolumeStorageSizeLimit() *resource.Quantity { + return hnp.humioNodeSpec.SharedVolumeStorageSizeLimit +} + func (hnp *HumioNodePool) GetTerminationGracePeriodSeconds() *int64 { if hnp.humioNodeSpec.TerminationGracePeriodSeconds == nil { return helpers.Int64Ptr(300) diff --git a/controllers/humiocluster_pods.go b/controllers/humiocluster_pods.go index 82fd562e..81ac64fc 100644 --- a/controllers/humiocluster_pods.go +++ b/controllers/humiocluster_pods.go @@ -147,8 +147,13 @@ func ConstructPod(hnp *HumioNodePool, humioNodeName string, attachments *podAtta }, Volumes: []corev1.Volume{ { - Name: "shared", - VolumeSource: corev1.VolumeSource{EmptyDir: &corev1.EmptyDirVolumeSource{}}, + Name: "shared", + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{ + Medium: hnp.GetSharedVolumeStorageMedium(), + SizeLimit: hnp.GetSharedVolumeStorageSizeLimit(), + }, + }, }, }, Affinity: hnp.GetAffinity(),