Skip to content

Commit

Permalink
Merge pull request #899 from humio/mike/add_kubebuilder_markers
Browse files Browse the repository at this point in the history
Add kubebuilder markers to attach more info to fields in generated CR…
  • Loading branch information
SaaldjorMike authored Jan 10, 2025
2 parents 5155752 + a037714 commit 42d7c04
Show file tree
Hide file tree
Showing 16 changed files with 77 additions and 17 deletions.
21 changes: 13 additions & 8 deletions api/v1alpha1/humioaction_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ type HumioActionWebhookProperties struct {
Headers map[string]string `json:"headers,omitempty"`
// SecretHeaders specifies what HTTP headers to use and where to fetch the values from.
// If both Headers and SecretHeaders are specified, they will be merged together.
//+kubebuilder:default={}
SecretHeaders []HeadersSource `json:"secretHeaders,omitempty"`
Method string `json:"method,omitempty"`
// Url specifies what URL to use
Expand All @@ -64,10 +65,12 @@ type HeadersSource struct {

// HumioActionEmailProperties defines the desired state of HumioActionEmailProperties
type HumioActionEmailProperties struct {
BodyTemplate string `json:"bodyTemplate,omitempty"`
SubjectTemplate string `json:"subjectTemplate,omitempty"`
Recipients []string `json:"recipients,omitempty"`
UseProxy bool `json:"useProxy,omitempty"`
BodyTemplate string `json:"bodyTemplate,omitempty"`
SubjectTemplate string `json:"subjectTemplate,omitempty"`
//+kubebuilder:validation:MinItems=1
//+required
Recipients []string `json:"recipients,omitempty"`
UseProxy bool `json:"useProxy,omitempty"`
}

// HumioActionRepositoryProperties defines the desired state of HumioActionRepositoryProperties
Expand Down Expand Up @@ -123,10 +126,12 @@ type HumioActionSlackPostMessageProperties struct {
ApiToken string `json:"apiToken,omitempty"`
// ApiTokenSource specifies where to fetch the API key from.
// If both ApiToken and ApiTokenSource are specified, ApiToken will be used.
ApiTokenSource VarSource `json:"apiTokenSource,omitempty"`
Channels []string `json:"channels,omitempty"`
Fields map[string]string `json:"fields,omitempty"`
UseProxy bool `json:"useProxy,omitempty"`
ApiTokenSource VarSource `json:"apiTokenSource,omitempty"`
Channels []string `json:"channels,omitempty"`
//+kubebuilder:default={}
Fields map[string]string `json:"fields,omitempty"`
//+kubebuilder:default=false
UseProxy bool `json:"useProxy,omitempty"`
}

// HumioActionVictorOpsProperties defines the desired state of HumioActionVictorOpsProperties
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/humioaggregatealert_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type HumioAggregateAlertSpec struct {
// Aggregate Alert trigger mode
TriggerMode string `json:"triggerMode,omitempty"`
// Enabled will set the AggregateAlert to enabled when set to true
//+kubebuilder:default=false
Enabled bool `json:"enabled,omitempty"`
// Actions is the list of Humio Actions by name that will be triggered by this Aggregate alert
Actions []string `json:"actions"`
Expand Down
6 changes: 5 additions & 1 deletion api/v1alpha1/humiocluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type HumioClusterSpec struct {
// DigestPartitionsCount is the desired number of digest partitions
DigestPartitionsCount int `json:"digestPartitionsCount,omitempty"`
// License is the kubernetes secret reference which contains the Humio license
//+required
License HumioClusterLicenseSpec `json:"license,omitempty"`
// IdpCertificateSecretName is the name of the secret that contains the IDP Certificate when using SAML authentication
IdpCertificateSecretName string `json:"idpCertificateSecretName,omitempty"`
Expand Down Expand Up @@ -125,6 +126,7 @@ type HumioNodeSpec struct {

// DisableInitContainer is used to disable the init container completely which collects the availability zone from the Kubernetes worker node.
// This is not recommended, unless you are using auto rebalancing partitions and are running in a single availability zone.
//+kubebuilder:default=false
DisableInitContainer bool `json:"disableInitContainer,omitempty"`

// EnvironmentVariablesSource is the reference to an external source of environment variables that will be merged with environmentVariables
Expand Down Expand Up @@ -253,6 +255,7 @@ type HumioNodeSpec struct {
UpdateStrategy *HumioUpdateStrategy `json:"updateStrategy,omitempty"`

// PriorityClassName is the name of the priority class that will be used by the Humio pods
//+kubebuilder:default=""
PriorityClassName string `json:"priorityClassName,omitempty"`

// HumioNodePoolFeatures defines the features that are allowed by the node pool
Expand Down Expand Up @@ -295,7 +298,7 @@ type HumioUpdateStrategy struct {

// MaxUnavailable is the maximum number of pods that can be unavailable during a rolling update.
// This can be configured to an absolute number or a percentage, e.g. "maxUnavailable: 5" or "maxUnavailable: 25%".
// By default, the max unavailable pods is 1.
//+kubebuilder:default=1
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
}

Expand Down Expand Up @@ -323,6 +326,7 @@ type HumioESHostnameSource struct {
type HumioClusterIngressSpec struct {
// Enabled enables the logic for the Humio operator to create ingress-related objects. Requires one of the following
// to be set: spec.hostname, spec.hostnameSource, spec.esHostname or spec.esHostnameSource
//+kubebuilder:default=false
Enabled bool `json:"enabled,omitempty"`
// Controller is used to specify the controller used for ingress in the Kubernetes cluster. For now, only nginx is supported.
Controller string `json:"controller,omitempty"`
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/humiofilteralert_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type HumioFilterAlertSpec struct {
//+required
ThrottleField *string `json:"throttleField,omitempty"`
// Enabled will set the FilterAlert to enabled when set to true
//+kubebuilder:default=false
Enabled bool `json:"enabled,omitempty"`
// Actions is the list of Humio Actions by name that will be triggered by this filter alert
Actions []string `json:"actions"`
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/humioscheduledsearch_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ type HumioScheduledSearchSpec struct {
// BackfillLimit is the user-defined limit, which caps the number of missed searches to backfill, e.g. in the event of a shutdown.
BackfillLimit int `json:"backfillLimit"`
// Enabled will set the ScheduledSearch to enabled when set to true
//+kubebuilder:default=false
Enabled bool `json:"enabled,omitempty"`
// Actions is the list of Humio Actions by name that will be triggered by this scheduled search
Actions []string `json:"actions"`
Expand Down
4 changes: 4 additions & 0 deletions charts/humio-operator/crds/core.humio.com_humioactions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ spec:
recipients:
items:
type: string
minItems: 1
type: array
subjectTemplate:
type: string
Expand Down Expand Up @@ -241,8 +242,10 @@ spec:
fields:
additionalProperties:
type: string
default: {}
type: object
useProxy:
default: false
type: boolean
type: object
slackProperties:
Expand Down Expand Up @@ -356,6 +359,7 @@ spec:
method:
type: string
secretHeaders:
default: []
description: |-
SecretHeaders specifies what HTTP headers to use and where to fetch the values from.
If both Headers and SecretHeaders are specified, they will be merged together.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ spec:
description: Description is the description of the Aggregate alert
type: string
enabled:
default: false
description: Enabled will set the AggregateAlert to enabled when set
to true
type: boolean
Expand Down
9 changes: 7 additions & 2 deletions charts/humio-operator/crds/core.humio.com_humioclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3576,6 +3576,7 @@ spec:
partitions
type: integer
disableInitContainer:
default: false
description: |-
DisableInitContainer is used to disable the init container completely which collects the availability zone from the Kubernetes worker node.
This is not recommended, unless you are using auto rebalancing partitions and are running in a single availability zone.
Expand Down Expand Up @@ -5664,6 +5665,7 @@ spec:
supported.
type: string
enabled:
default: false
description: |-
Enabled enables the logic for the Humio operator to create ingress-related objects. Requires one of the following
to be set: spec.hostname, spec.hostnameSource, spec.esHostname or spec.esHostnameSource
Expand Down Expand Up @@ -9178,6 +9180,7 @@ spec:
type: object
type: object
disableInitContainer:
default: false
description: |-
DisableInitContainer is used to disable the init container completely which collects the availability zone from the Kubernetes worker node.
This is not recommended, unless you are using auto rebalancing partitions and are running in a single availability zone.
Expand Down Expand Up @@ -11424,6 +11427,7 @@ spec:
type: object
type: object
priorityClassName:
default: ""
description: PriorityClassName is the name of the priority
class that will be used by the Humio pods
type: string
Expand Down Expand Up @@ -13095,10 +13099,10 @@ spec:
anyOf:
- type: integer
- type: string
default: 1
description: |-
MaxUnavailable is the maximum number of pods that can be unavailable during a rolling update.
This can be configured to an absolute number or a percentage, e.g. "maxUnavailable: 5" or "maxUnavailable: 25%".
By default, the max unavailable pods is 1.
x-kubernetes-int-or-string: true
minReadySeconds:
description: MinReadySeconds is the minimum time in
Expand Down Expand Up @@ -13336,6 +13340,7 @@ spec:
type: object
type: object
priorityClassName:
default: ""
description: PriorityClassName is the name of the priority class that
will be used by the Humio pods
type: string
Expand Down Expand Up @@ -15016,10 +15021,10 @@ spec:
anyOf:
- type: integer
- type: string
default: 1
description: |-
MaxUnavailable is the maximum number of pods that can be unavailable during a rolling update.
This can be configured to an absolute number or a percentage, e.g. "maxUnavailable: 5" or "maxUnavailable: 25%".
By default, the max unavailable pods is 1.
x-kubernetes-int-or-string: true
minReadySeconds:
description: MinReadySeconds is the minimum time in seconds that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ spec:
description: Description is the description of the filter alert
type: string
enabled:
default: false
description: Enabled will set the FilterAlert to enabled when set
to true
type: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ spec:
description: Description is the description of the scheduled search
type: string
enabled:
default: false
description: Enabled will set the ScheduledSearch to enabled when
set to true
type: boolean
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/core.humio.com_humioactions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ spec:
recipients:
items:
type: string
minItems: 1
type: array
subjectTemplate:
type: string
Expand Down Expand Up @@ -241,8 +242,10 @@ spec:
fields:
additionalProperties:
type: string
default: {}
type: object
useProxy:
default: false
type: boolean
type: object
slackProperties:
Expand Down Expand Up @@ -356,6 +359,7 @@ spec:
method:
type: string
secretHeaders:
default: []
description: |-
SecretHeaders specifies what HTTP headers to use and where to fetch the values from.
If both Headers and SecretHeaders are specified, they will be merged together.
Expand Down
1 change: 1 addition & 0 deletions config/crd/bases/core.humio.com_humioaggregatealerts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ spec:
description: Description is the description of the Aggregate alert
type: string
enabled:
default: false
description: Enabled will set the AggregateAlert to enabled when set
to true
type: boolean
Expand Down
9 changes: 7 additions & 2 deletions config/crd/bases/core.humio.com_humioclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3576,6 +3576,7 @@ spec:
partitions
type: integer
disableInitContainer:
default: false
description: |-
DisableInitContainer is used to disable the init container completely which collects the availability zone from the Kubernetes worker node.
This is not recommended, unless you are using auto rebalancing partitions and are running in a single availability zone.
Expand Down Expand Up @@ -5664,6 +5665,7 @@ spec:
supported.
type: string
enabled:
default: false
description: |-
Enabled enables the logic for the Humio operator to create ingress-related objects. Requires one of the following
to be set: spec.hostname, spec.hostnameSource, spec.esHostname or spec.esHostnameSource
Expand Down Expand Up @@ -9178,6 +9180,7 @@ spec:
type: object
type: object
disableInitContainer:
default: false
description: |-
DisableInitContainer is used to disable the init container completely which collects the availability zone from the Kubernetes worker node.
This is not recommended, unless you are using auto rebalancing partitions and are running in a single availability zone.
Expand Down Expand Up @@ -11424,6 +11427,7 @@ spec:
type: object
type: object
priorityClassName:
default: ""
description: PriorityClassName is the name of the priority
class that will be used by the Humio pods
type: string
Expand Down Expand Up @@ -13095,10 +13099,10 @@ spec:
anyOf:
- type: integer
- type: string
default: 1
description: |-
MaxUnavailable is the maximum number of pods that can be unavailable during a rolling update.
This can be configured to an absolute number or a percentage, e.g. "maxUnavailable: 5" or "maxUnavailable: 25%".
By default, the max unavailable pods is 1.
x-kubernetes-int-or-string: true
minReadySeconds:
description: MinReadySeconds is the minimum time in
Expand Down Expand Up @@ -13336,6 +13340,7 @@ spec:
type: object
type: object
priorityClassName:
default: ""
description: PriorityClassName is the name of the priority class that
will be used by the Humio pods
type: string
Expand Down Expand Up @@ -15016,10 +15021,10 @@ spec:
anyOf:
- type: integer
- type: string
default: 1
description: |-
MaxUnavailable is the maximum number of pods that can be unavailable during a rolling update.
This can be configured to an absolute number or a percentage, e.g. "maxUnavailable: 5" or "maxUnavailable: 25%".
By default, the max unavailable pods is 1.
x-kubernetes-int-or-string: true
minReadySeconds:
description: MinReadySeconds is the minimum time in seconds that
Expand Down
1 change: 1 addition & 0 deletions config/crd/bases/core.humio.com_humiofilteralerts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ spec:
description: Description is the description of the filter alert
type: string
enabled:
default: false
description: Enabled will set the FilterAlert to enabled when set
to true
type: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ spec:
description: Description is the description of the scheduled search
type: string
enabled:
default: false
description: Enabled will set the ScheduledSearch to enabled when
set to true
type: boolean
Expand Down
Loading

0 comments on commit 42d7c04

Please sign in to comment.