Skip to content

Commit

Permalink
Add configs for shared volume
Browse files Browse the repository at this point in the history
  • Loading branch information
SaaldjorMike committed Oct 28, 2024
1 parent 33494ae commit df4056e
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 2 deletions.
9 changes: 9 additions & 0 deletions api/v1alpha1/humiocluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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 {
Expand Down
28 changes: 28 additions & 0 deletions charts/humio-operator/crds/core.humio.com_humioclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
28 changes: 28 additions & 0 deletions config/crd/bases/core.humio.com_humioclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions controllers/humiocluster_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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)
Expand Down
9 changes: 7 additions & 2 deletions controllers/humiocluster_pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit df4056e

Please sign in to comment.