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

Require non empty resource names #854

Merged
merged 3 commits into from
Sep 17, 2024
Merged
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
8 changes: 7 additions & 1 deletion api/v1alpha1/humioaction_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ type HumioActionWebhookProperties struct {
// HeadersSource defines a header and corresponding source for the value of it.
type HeadersSource struct {
// Name is the name of the header.
Name string `json:"name,omitempty"`
//+kubebuilder:validation:MinLength=1
//+required
Name string `json:"name"`
// ValueFrom defines where to fetch the value of the header from.
ValueFrom VarSource `json:"valueFrom,omitempty"`
}
Expand Down Expand Up @@ -155,8 +157,12 @@ type HumioActionSpec struct {
// This conflicts with ManagedClusterName.
ExternalClusterName string `json:"externalClusterName,omitempty"`
// Name is the name of the Action
//+kubebuilder:validation:MinLength=1
//+required
Name string `json:"name"`
// ViewName is the name of the Humio View under which the Action will be managed. This can also be a Repository
//+kubebuilder:validation:MinLength=1
//+required
ViewName string `json:"viewName"`
// EmailProperties indicates this is an Email Action, and contains the corresponding properties
EmailProperties *HumioActionEmailProperties `json:"emailProperties,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/humioaggregatealert_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@ type HumioAggregateAlertSpec struct {
// This conflicts with ManagedClusterName.
ExternalClusterName string `json:"externalClusterName,omitempty"`
// Name is the name of the aggregate alert inside Humio
//+kubebuilder:validation:MinLength=1
//+required
Name string `json:"name"`
// ViewName is the name of the Humio View under which the aggregate alert will be managed. This can also be a Repository
//+kubebuilder:validation:MinLength=1
//+required
ViewName string `json:"viewName"`
// QueryString defines the desired Humio query string
QueryString string `json:"queryString"`
// QueryTimestampType defines the timestamp type to use for a query
QueryTimestampType string `json:"queryTimestampType,omitempty"`
// Description is the description of the Aggregate alert
//+optional
Description string `json:"description,omitempty"`
// Search Interval time in seconds
SearchIntervalSeconds int `json:"searchIntervalSeconds,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/humioalert_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,17 @@ type HumioAlertSpec struct {
// This conflicts with ManagedClusterName.
ExternalClusterName string `json:"externalClusterName,omitempty"`
// Name is the name of the alert inside Humio
//+kubebuilder:validation:MinLength=1
//+required
Name string `json:"name"`
// ViewName is the name of the Humio View under which the Alert will be managed. This can also be a Repository
//+kubebuilder:validation:MinLength=1
//+required
ViewName string `json:"viewName"`
// Query defines the desired state of the Humio query
Query HumioQuery `json:"query"`
// Description is the description of the Alert
//+optional
Description string `json:"description,omitempty"`
// ThrottleTimeMillis is the throttle time in milliseconds. An Alert is triggered at most once per the throttle time
ThrottleTimeMillis int `json:"throttleTimeMillis,omitempty"`
Expand Down
9 changes: 6 additions & 3 deletions api/v1alpha1/humiocluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,9 @@ type HumioUpdateStrategy struct {
}

type HumioNodePoolSpec struct {
// TODO: Mark name as required and non-empty, perhaps even confirm the content somehow
Name string `json:"name,omitempty"`
//+kubebuilder:validation:MinLength:=1
//+required
Name string `json:"name"`

HumioNodeSpec `json:"spec,omitempty"`
}
Expand Down Expand Up @@ -376,7 +377,9 @@ type HumioNodePoolStatusList []HumioNodePoolStatus
// HumioNodePoolStatus shows the status of each node pool
type HumioNodePoolStatus struct {
// Name is the name of the node pool
Name string `json:"name,omitempty"`
//+kubebuilder:validation:MinLength=1
//+required
Name string `json:"name"`
// State will be empty before the cluster is bootstrapped. From there it can be "Running", "Upgrading", "Restarting" or "Pending"
State string `json:"state,omitempty"`
// DesiredPodRevision holds the desired pod revision for pods of the given node pool.
Expand Down
4 changes: 3 additions & 1 deletion api/v1alpha1/humioexternalcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ const (
// HumioExternalClusterSpec defines the desired state of HumioExternalCluster
type HumioExternalClusterSpec struct {
// Url is used to connect to the Humio cluster we want to use.
Url string `json:"url,omitempty"`
//+kubebuilder:validation:MinLength=1
//+required
Url string `json:"url"`
// APITokenSecretName is used to obtain the API token we need to use when communicating with the external Humio cluster.
// The secret must contain a key "token" which holds the Humio API token.
APITokenSecretName string `json:"apiTokenSecretName,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/humiofilteralert_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@ type HumioFilterAlertSpec struct {
// This conflicts with ManagedClusterName.
ExternalClusterName string `json:"externalClusterName,omitempty"`
// Name is the name of the filter alert inside Humio
//+kubebuilder:validation:MinLength=1
//+required
Name string `json:"name"`
// ViewName is the name of the Humio View under which the filter alert will be managed. This can also be a Repository
//+kubebuilder:validation:MinLength=1
//+required
ViewName string `json:"viewName"`
// QueryString defines the desired Humio query string
QueryString string `json:"queryString"`
// Description is the description of the filter alert
//+optional
Description string `json:"description,omitempty"`
// ThrottleTimeSeconds is the throttle time in seconds. A filter alert is triggered at most once per the throttle time
ThrottleTimeSeconds int `json:"throttleTimeSeconds,omitempty"`
Expand Down
6 changes: 6 additions & 0 deletions api/v1alpha1/humioingesttoken_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ type HumioIngestTokenSpec struct {
// This conflicts with ManagedClusterName.
ExternalClusterName string `json:"externalClusterName,omitempty"`
// Name is the name of the ingest token inside Humio
//+kubebuilder:validation:MinLength=1
//+required
Name string `json:"name"`
// ParserName is the name of the parser which will be assigned to the ingest token.
//+kubebuilder:validation:MinLength=1
//+required
ParserName string `json:"parserName,omitempty"`
// RepositoryName is the name of the Humio repository under which the ingest token will be created
//+kubebuilder:validation:MinLength=1
//+required
RepositoryName string `json:"repositoryName,omitempty"`
// TokenSecretName specifies the name of the Kubernetes secret that will be created
// and contain the ingest token. The key in the secret storing the ingest token is "token".
Expand Down
6 changes: 5 additions & 1 deletion api/v1alpha1/humioparser_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ type HumioParserSpec struct {
// This conflicts with ManagedClusterName.
ExternalClusterName string `json:"externalClusterName,omitempty"`
// Name is the name of the parser inside Humio
Name string `json:"name,omitempty"`
//+kubebuilder:validation:MinLength=1
//+required
Name string `json:"name"`
// ParserScript contains the code for the Humio parser
ParserScript string `json:"parserScript,omitempty"`
// RepositoryName defines what repository this parser should be managed in
//+kubebuilder:validation:MinLength=1
//+required
RepositoryName string `json:"repositoryName,omitempty"`
// TagFields is used to define what fields will be used to define how data will be tagged when being parsed by
// this parser
Expand Down
5 changes: 4 additions & 1 deletion api/v1alpha1/humiorepository_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ type HumioRepositorySpec struct {
// This conflicts with ManagedClusterName.
ExternalClusterName string `json:"externalClusterName,omitempty"`
// Name is the name of the repository inside Humio
Name string `json:"name,omitempty"`
//+kubebuilder:validation:MinLength=1
//+required
Name string `json:"name"`
// Description contains the description that will be set on the repository
//+optional
Description string `json:"description,omitempty"`
// Retention defines the retention settings for the repository
Retention HumioRetention `json:"retention,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/humioscheduledsearch_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,17 @@ type HumioScheduledSearchSpec struct {
// This conflicts with ManagedClusterName.
ExternalClusterName string `json:"externalClusterName,omitempty"`
// Name is the name of the scheduled search inside Humio
//+kubebuilder:validation:MinLength=1
//+required
Name string `json:"name"`
// ViewName is the name of the Humio View under which the scheduled search will be managed. This can also be a Repository
//+kubebuilder:validation:MinLength=1
//+required
ViewName string `json:"viewName"`
// QueryString defines the desired Humio query string
QueryString string `json:"queryString"`
// Description is the description of the scheduled search
//+optional
Description string `json:"description,omitempty"`
// QueryStart is the start of the relative time interval for the query.
QueryStart string `json:"queryStart"`
Expand Down
7 changes: 6 additions & 1 deletion api/v1alpha1/humioview_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ const (

type HumioViewConnection struct {
// RepositoryName contains the name of the target repository
//+kubebuilder:validation:MinLength=1
//+required
RepositoryName string `json:"repositoryName,omitempty"`
// Filter contains the prefix filter that will be applied for the given RepositoryName
Filter string `json:"filter,omitempty"`
Expand All @@ -49,8 +51,11 @@ type HumioViewSpec struct {
// This conflicts with ManagedClusterName.
ExternalClusterName string `json:"externalClusterName,omitempty"`
// Name is the name of the view inside Humio
Name string `json:"name,omitempty"`
//+kubebuilder:validation:MinLength=1
//+required
Name string `json:"name"`
// Description contains the description that will be set on the view
//+optional
Description string `json:"description,omitempty"`
// Connections contains the connections to the Humio repositories which is accessible in this view
Connections []HumioViewConnection `json:"connections,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions charts/humio-operator/crds/core.humio.com_humioactions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ spec:
type: string
name:
description: Name is the name of the Action
minLength: 1
type: string
opsGenieProperties:
description: OpsGenieProperties indicates this is a Ops Genie Action,
Expand Down Expand Up @@ -335,6 +336,7 @@ spec:
viewName:
description: ViewName is the name of the Humio View under which the
Action will be managed. This can also be a Repository
minLength: 1
type: string
webhookProperties:
description: WebhookProperties indicates this is a Webhook Action,
Expand Down Expand Up @@ -363,6 +365,7 @@ spec:
properties:
name:
description: Name is the name of the header.
minLength: 1
type: string
valueFrom:
description: ValueFrom defines where to fetch the value
Expand Down Expand Up @@ -392,6 +395,8 @@ spec:
type: object
x-kubernetes-map-type: atomic
type: object
required:
- name
type: object
type: array
url:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ spec:
type: string
name:
description: Name is the name of the aggregate alert inside Humio
minLength: 1
type: string
queryString:
description: QueryString defines the desired Humio query string
Expand All @@ -101,6 +102,7 @@ spec:
viewName:
description: ViewName is the name of the Humio View under which the
aggregate alert will be managed. This can also be a Repository
minLength: 1
type: string
required:
- actions
Expand Down
2 changes: 2 additions & 0 deletions charts/humio-operator/crds/core.humio.com_humioalerts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ spec:
type: string
name:
description: Name is the name of the alert inside Humio
minLength: 1
type: string
query:
description: Query defines the desired state of the Humio query
Expand Down Expand Up @@ -110,6 +111,7 @@ spec:
viewName:
description: ViewName is the name of the Humio View under which the
Alert will be managed. This can also be a Repository
minLength: 1
type: string
required:
- actions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5734,8 +5734,7 @@ spec:
items:
properties:
name:
description: 'TODO: Mark name as required and non-empty, perhaps
even confirm the content somehow'
minLength: 1
type: string
spec:
properties:
Expand Down Expand Up @@ -13117,6 +13116,8 @@ spec:
type: string
type: object
type: object
required:
- name
type: object
type: array
nodeUUIDPrefix:
Expand Down Expand Up @@ -15054,12 +15055,15 @@ spec:
type: integer
name:
description: Name is the name of the node pool
minLength: 1
type: string
state:
description: State will be empty before the cluster is bootstrapped.
From there it can be "Running", "Upgrading", "Restarting"
or "Pending"
type: string
required:
- name
type: object
type: array
observedGeneration:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ spec:
url:
description: Url is used to connect to the Humio cluster we want to
use.
minLength: 1
type: string
required:
- url
type: object
status:
description: HumioExternalClusterStatus defines the observed state of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ spec:
type: string
name:
description: Name is the name of the filter alert inside Humio
minLength: 1
type: string
queryString:
description: QueryString defines the desired Humio query string
Expand All @@ -90,6 +91,7 @@ spec:
viewName:
description: ViewName is the name of the Humio View under which the
filter alert will be managed. This can also be a Repository
minLength: 1
type: string
required:
- actions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,17 @@ spec:
type: string
name:
description: Name is the name of the ingest token inside Humio
minLength: 1
type: string
parserName:
description: ParserName is the name of the parser which will be assigned
to the ingest token.
minLength: 1
type: string
repositoryName:
description: RepositoryName is the name of the Humio repository under
which the ingest token will be created
minLength: 1
type: string
tokenSecretLabels:
additionalProperties:
Expand Down
4 changes: 4 additions & 0 deletions charts/humio-operator/crds/core.humio.com_humioparsers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,15 @@ spec:
type: string
name:
description: Name is the name of the parser inside Humio
minLength: 1
type: string
parserScript:
description: ParserScript contains the code for the Humio parser
type: string
repositoryName:
description: RepositoryName defines what repository this parser should
be managed in
minLength: 1
type: string
tagFields:
description: |-
Expand All @@ -84,6 +86,8 @@ spec:
items:
type: string
type: array
required:
- name
type: object
status:
description: HumioParserStatus defines the observed state of HumioParser
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ spec:
type: string
name:
description: Name is the name of the repository inside Humio
minLength: 1
type: string
retention:
description: Retention defines the retention settings for the repository
Expand All @@ -94,6 +95,8 @@ spec:
format: int32
type: integer
type: object
required:
- name
type: object
status:
description: HumioRepositoryStatus defines the observed state of HumioRepository
Expand Down
Loading
Loading