Skip to content

Commit

Permalink
Pod Disruption Budget implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
triceras committed Jan 13, 2025
1 parent 42d7c04 commit d428c43
Show file tree
Hide file tree
Showing 6 changed files with 618 additions and 2 deletions.
24 changes: 23 additions & 1 deletion api/v1alpha1/humiocluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ type HumioClusterSpec struct {

// NodePools can be used to define additional groups of Humio cluster pods that share a set of configuration.
NodePools []HumioNodePoolSpec `json:"nodePools,omitempty"`

// PodDisruptionBudget allows configuring PDB for the cluster
PodDisruptionBudget *HumioPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`
}

type HumioNodeSpec struct {
Expand Down Expand Up @@ -301,15 +304,34 @@ type HumioUpdateStrategy struct {
//+kubebuilder:default=1
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
}

type HumioNodePoolSpec struct {
//+kubebuilder:validation:MinLength:=1
//+required
Name string `json:"name"`

// PodDisruptionBudget defines the PDB configuration for this node pool
PodDisruptionBudget *HumioPodDisruptionBudgetSpec `json:"podDisruptionBudget,omitempty"`

HumioNodeSpec `json:"spec,omitempty"`
}

// HumioPodDisruptionBudgetSpec defines the PDB configuration for a node pool
type HumioPodDisruptionBudgetSpec struct {
// MinAvailable represents the minimum number of pods that should be available for this Humio node pool.
// If not set, the operator will not create a PodDisruptionBudget for the node pool.
// Can be a percentage or a fixed number.
MinAvailable *intstr.IntOrString `json:"minAvailable,omitempty"`

// MaxUnavailable represents the maximum number of pods that can be unavailable for this Humio node pool
// If not set, the operator will not use a MaxUnavailable value for the node pool's PodDisruptionBudget.
// Can be a percentage or a fixed number.
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`

// UnhealthyPodEvictionPolicy defines the policy for evicting unhealthy pods
// +kubebuilder:validation:Enum=AlwaysAllow;IfHealthyBudget
UnhealthyPodEvictionPolicy *string `json:"unhealthyPodEvictionPolicy,omitempty"`
}

// HumioHostnameSource is the possible references to a hostname value that is stored outside of the HumioCluster resource
type HumioHostnameSource struct {
// SecretKeyRef contains the secret key reference when a hostname is pulled from a secret
Expand Down
40 changes: 40 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions charts/humio-operator/crds/core.humio.com_humioclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5739,6 +5739,36 @@ spec:
name:
minLength: 1
type: string
podDisruptionBudget:
description: PodDisruptionBudget defines the PDB configuration
for this node pool
properties:
maxUnavailable:
anyOf:
- type: integer
- type: string
description: |-
MaxUnavailable represents the maximum number of pods that can be unavailable for this Humio node pool
If not set, the operator will not use a MaxUnavailable value for the node pool's PodDisruptionBudget.
Can be a percentage or a fixed number.
x-kubernetes-int-or-string: true
minAvailable:
anyOf:
- type: integer
- type: string
description: |-
MinAvailable represents the minimum number of pods that should be available for this Humio node pool.
If not set, the operator will not create a PodDisruptionBudget for the node pool.
Can be a percentage or a fixed number.
x-kubernetes-int-or-string: true
unhealthyPodEvictionPolicy:
description: UnhealthyPodEvictionPolicy defines the policy
for evicting unhealthy pods
enum:
- AlwaysAllow
- IfHealthyBudget
type: string
type: object
spec:
properties:
affinity:
Expand Down Expand Up @@ -13158,6 +13188,35 @@ spec:
description: PodAnnotations can be used to specify annotations that
will be added to the Humio pods
type: object
podDisruptionBudget:
description: PodDisruptionBudget allows configuring PDB for the cluster
properties:
maxUnavailable:
anyOf:
- type: integer
- type: string
description: |-
MaxUnavailable represents the maximum number of pods that can be unavailable for this Humio node pool
If not set, the operator will not use a MaxUnavailable value for the node pool's PodDisruptionBudget.
Can be a percentage or a fixed number.
x-kubernetes-int-or-string: true
minAvailable:
anyOf:
- type: integer
- type: string
description: |-
MinAvailable represents the minimum number of pods that should be available for this Humio node pool.
If not set, the operator will not create a PodDisruptionBudget for the node pool.
Can be a percentage or a fixed number.
x-kubernetes-int-or-string: true
unhealthyPodEvictionPolicy:
description: UnhealthyPodEvictionPolicy defines the policy for
evicting unhealthy pods
enum:
- AlwaysAllow
- IfHealthyBudget
type: string
type: object
podLabels:
additionalProperties:
type: string
Expand Down
59 changes: 59 additions & 0 deletions config/crd/bases/core.humio.com_humioclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5739,6 +5739,36 @@ spec:
name:
minLength: 1
type: string
podDisruptionBudget:
description: PodDisruptionBudget defines the PDB configuration
for this node pool
properties:
maxUnavailable:
anyOf:
- type: integer
- type: string
description: |-
MaxUnavailable represents the maximum number of pods that can be unavailable for this Humio node pool
If not set, the operator will not use a MaxUnavailable value for the node pool's PodDisruptionBudget.
Can be a percentage or a fixed number.
x-kubernetes-int-or-string: true
minAvailable:
anyOf:
- type: integer
- type: string
description: |-
MinAvailable represents the minimum number of pods that should be available for this Humio node pool.
If not set, the operator will not create a PodDisruptionBudget for the node pool.
Can be a percentage or a fixed number.
x-kubernetes-int-or-string: true
unhealthyPodEvictionPolicy:
description: UnhealthyPodEvictionPolicy defines the policy
for evicting unhealthy pods
enum:
- AlwaysAllow
- IfHealthyBudget
type: string
type: object
spec:
properties:
affinity:
Expand Down Expand Up @@ -13158,6 +13188,35 @@ spec:
description: PodAnnotations can be used to specify annotations that
will be added to the Humio pods
type: object
podDisruptionBudget:
description: PodDisruptionBudget allows configuring PDB for the cluster
properties:
maxUnavailable:
anyOf:
- type: integer
- type: string
description: |-
MaxUnavailable represents the maximum number of pods that can be unavailable for this Humio node pool
If not set, the operator will not use a MaxUnavailable value for the node pool's PodDisruptionBudget.
Can be a percentage or a fixed number.
x-kubernetes-int-or-string: true
minAvailable:
anyOf:
- type: integer
- type: string
description: |-
MinAvailable represents the minimum number of pods that should be available for this Humio node pool.
If not set, the operator will not create a PodDisruptionBudget for the node pool.
Can be a percentage or a fixed number.
x-kubernetes-int-or-string: true
unhealthyPodEvictionPolicy:
description: UnhealthyPodEvictionPolicy defines the policy for
evicting unhealthy pods
enum:
- AlwaysAllow
- IfHealthyBudget
type: string
type: object
podLabels:
additionalProperties:
type: string
Expand Down
Loading

0 comments on commit d428c43

Please sign in to comment.