Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configs for shared volume #871

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading