From cbc549ffaf553dc3c99ea2767f2d9ecd60bec95e Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Tue, 17 Sep 2024 11:05:04 +0200 Subject: [PATCH] Require non empty resource names (#854) * Require non empty resource names * Log out test case failure reason if present * mock: use lock when accessing map with user details --- api/v1alpha1/humioaction_types.go | 8 +++++++- api/v1alpha1/humioaggregatealert_types.go | 5 +++++ api/v1alpha1/humioalert_types.go | 5 +++++ api/v1alpha1/humiocluster_types.go | 9 ++++++--- api/v1alpha1/humioexternalcluster_types.go | 4 +++- api/v1alpha1/humiofilteralert_types.go | 5 +++++ api/v1alpha1/humioingesttoken_types.go | 6 ++++++ api/v1alpha1/humioparser_types.go | 6 +++++- api/v1alpha1/humiorepository_types.go | 5 ++++- api/v1alpha1/humioscheduledsearch_types.go | 5 +++++ api/v1alpha1/humioview_types.go | 7 ++++++- .../humio-operator/crds/core.humio.com_humioactions.yaml | 5 +++++ .../crds/core.humio.com_humioaggregatealerts.yaml | 2 ++ .../humio-operator/crds/core.humio.com_humioalerts.yaml | 2 ++ .../crds/core.humio.com_humioclusters.yaml | 8 ++++++-- .../crds/core.humio.com_humioexternalclusters.yaml | 3 +++ .../crds/core.humio.com_humiofilteralerts.yaml | 2 ++ .../crds/core.humio.com_humioingesttokens.yaml | 3 +++ .../humio-operator/crds/core.humio.com_humioparsers.yaml | 4 ++++ .../crds/core.humio.com_humiorepositories.yaml | 3 +++ .../crds/core.humio.com_humioscheduledsearches.yaml | 2 ++ .../humio-operator/crds/core.humio.com_humioviews.yaml | 4 ++++ config/crd/bases/core.humio.com_humioactions.yaml | 5 +++++ .../crd/bases/core.humio.com_humioaggregatealerts.yaml | 2 ++ config/crd/bases/core.humio.com_humioalerts.yaml | 2 ++ config/crd/bases/core.humio.com_humioclusters.yaml | 8 ++++++-- .../crd/bases/core.humio.com_humioexternalclusters.yaml | 3 +++ config/crd/bases/core.humio.com_humiofilteralerts.yaml | 2 ++ config/crd/bases/core.humio.com_humioingesttokens.yaml | 3 +++ config/crd/bases/core.humio.com_humioparsers.yaml | 4 ++++ config/crd/bases/core.humio.com_humiorepositories.yaml | 3 +++ .../crd/bases/core.humio.com_humioscheduledsearches.yaml | 2 ++ config/crd/bases/core.humio.com_humioviews.yaml | 4 ++++ controllers/suite/clusters/suite_test.go | 3 +++ pkg/humio/client_mock.go | 3 +++ 35 files changed, 135 insertions(+), 12 deletions(-) diff --git a/api/v1alpha1/humioaction_types.go b/api/v1alpha1/humioaction_types.go index d2669ff0..059ae010 100644 --- a/api/v1alpha1/humioaction_types.go +++ b/api/v1alpha1/humioaction_types.go @@ -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"` } @@ -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"` diff --git a/api/v1alpha1/humioaggregatealert_types.go b/api/v1alpha1/humioaggregatealert_types.go index 23f4022e..a86cca8f 100644 --- a/api/v1alpha1/humioaggregatealert_types.go +++ b/api/v1alpha1/humioaggregatealert_types.go @@ -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"` diff --git a/api/v1alpha1/humioalert_types.go b/api/v1alpha1/humioalert_types.go index 84f4f4ff..4a17bef1 100644 --- a/api/v1alpha1/humioalert_types.go +++ b/api/v1alpha1/humioalert_types.go @@ -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"` diff --git a/api/v1alpha1/humiocluster_types.go b/api/v1alpha1/humiocluster_types.go index 32201784..ec2f8001 100644 --- a/api/v1alpha1/humiocluster_types.go +++ b/api/v1alpha1/humiocluster_types.go @@ -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"` } @@ -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. diff --git a/api/v1alpha1/humioexternalcluster_types.go b/api/v1alpha1/humioexternalcluster_types.go index 21e52928..cfa46ee2 100644 --- a/api/v1alpha1/humioexternalcluster_types.go +++ b/api/v1alpha1/humioexternalcluster_types.go @@ -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"` diff --git a/api/v1alpha1/humiofilteralert_types.go b/api/v1alpha1/humiofilteralert_types.go index f29116cf..2a6be80e 100644 --- a/api/v1alpha1/humiofilteralert_types.go +++ b/api/v1alpha1/humiofilteralert_types.go @@ -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"` diff --git a/api/v1alpha1/humioingesttoken_types.go b/api/v1alpha1/humioingesttoken_types.go index 2f5de736..eac33094 100644 --- a/api/v1alpha1/humioingesttoken_types.go +++ b/api/v1alpha1/humioingesttoken_types.go @@ -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". diff --git a/api/v1alpha1/humioparser_types.go b/api/v1alpha1/humioparser_types.go index 154fb995..a77f15f2 100644 --- a/api/v1alpha1/humioparser_types.go +++ b/api/v1alpha1/humioparser_types.go @@ -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 diff --git a/api/v1alpha1/humiorepository_types.go b/api/v1alpha1/humiorepository_types.go index fba39b4e..83668b81 100644 --- a/api/v1alpha1/humiorepository_types.go +++ b/api/v1alpha1/humiorepository_types.go @@ -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"` diff --git a/api/v1alpha1/humioscheduledsearch_types.go b/api/v1alpha1/humioscheduledsearch_types.go index 50ebd563..89a9eb8b 100644 --- a/api/v1alpha1/humioscheduledsearch_types.go +++ b/api/v1alpha1/humioscheduledsearch_types.go @@ -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"` diff --git a/api/v1alpha1/humioview_types.go b/api/v1alpha1/humioview_types.go index 4c2084df..dfd31695 100644 --- a/api/v1alpha1/humioview_types.go +++ b/api/v1alpha1/humioview_types.go @@ -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"` @@ -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"` diff --git a/charts/humio-operator/crds/core.humio.com_humioactions.yaml b/charts/humio-operator/crds/core.humio.com_humioactions.yaml index 275ad98a..8c994d56 100644 --- a/charts/humio-operator/crds/core.humio.com_humioactions.yaml +++ b/charts/humio-operator/crds/core.humio.com_humioactions.yaml @@ -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, @@ -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, @@ -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 @@ -392,6 +395,8 @@ spec: type: object x-kubernetes-map-type: atomic type: object + required: + - name type: object type: array url: diff --git a/charts/humio-operator/crds/core.humio.com_humioaggregatealerts.yaml b/charts/humio-operator/crds/core.humio.com_humioaggregatealerts.yaml index 7fd4369f..a57674cb 100644 --- a/charts/humio-operator/crds/core.humio.com_humioaggregatealerts.yaml +++ b/charts/humio-operator/crds/core.humio.com_humioaggregatealerts.yaml @@ -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 @@ -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 diff --git a/charts/humio-operator/crds/core.humio.com_humioalerts.yaml b/charts/humio-operator/crds/core.humio.com_humioalerts.yaml index 2dbc7e8e..8727804a 100644 --- a/charts/humio-operator/crds/core.humio.com_humioalerts.yaml +++ b/charts/humio-operator/crds/core.humio.com_humioalerts.yaml @@ -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 @@ -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 diff --git a/charts/humio-operator/crds/core.humio.com_humioclusters.yaml b/charts/humio-operator/crds/core.humio.com_humioclusters.yaml index 8e03ec5f..71156207 100644 --- a/charts/humio-operator/crds/core.humio.com_humioclusters.yaml +++ b/charts/humio-operator/crds/core.humio.com_humioclusters.yaml @@ -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: @@ -13117,6 +13116,8 @@ spec: type: string type: object type: object + required: + - name type: object type: array nodeUUIDPrefix: @@ -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: diff --git a/charts/humio-operator/crds/core.humio.com_humioexternalclusters.yaml b/charts/humio-operator/crds/core.humio.com_humioexternalclusters.yaml index b60263f9..a444c86d 100644 --- a/charts/humio-operator/crds/core.humio.com_humioexternalclusters.yaml +++ b/charts/humio-operator/crds/core.humio.com_humioexternalclusters.yaml @@ -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 diff --git a/charts/humio-operator/crds/core.humio.com_humiofilteralerts.yaml b/charts/humio-operator/crds/core.humio.com_humiofilteralerts.yaml index 1a5107b9..eb43f8d3 100644 --- a/charts/humio-operator/crds/core.humio.com_humiofilteralerts.yaml +++ b/charts/humio-operator/crds/core.humio.com_humiofilteralerts.yaml @@ -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 @@ -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 diff --git a/charts/humio-operator/crds/core.humio.com_humioingesttokens.yaml b/charts/humio-operator/crds/core.humio.com_humioingesttokens.yaml index 4632eda0..4c84b242 100644 --- a/charts/humio-operator/crds/core.humio.com_humioingesttokens.yaml +++ b/charts/humio-operator/crds/core.humio.com_humioingesttokens.yaml @@ -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: diff --git a/charts/humio-operator/crds/core.humio.com_humioparsers.yaml b/charts/humio-operator/crds/core.humio.com_humioparsers.yaml index acf7ba2f..ffc8710c 100644 --- a/charts/humio-operator/crds/core.humio.com_humioparsers.yaml +++ b/charts/humio-operator/crds/core.humio.com_humioparsers.yaml @@ -63,6 +63,7 @@ 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 @@ -70,6 +71,7 @@ spec: repositoryName: description: RepositoryName defines what repository this parser should be managed in + minLength: 1 type: string tagFields: description: |- @@ -84,6 +86,8 @@ spec: items: type: string type: array + required: + - name type: object status: description: HumioParserStatus defines the observed state of HumioParser diff --git a/charts/humio-operator/crds/core.humio.com_humiorepositories.yaml b/charts/humio-operator/crds/core.humio.com_humiorepositories.yaml index 08244fb4..7696676f 100644 --- a/charts/humio-operator/crds/core.humio.com_humiorepositories.yaml +++ b/charts/humio-operator/crds/core.humio.com_humiorepositories.yaml @@ -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 @@ -94,6 +95,8 @@ spec: format: int32 type: integer type: object + required: + - name type: object status: description: HumioRepositoryStatus defines the observed state of HumioRepository diff --git a/charts/humio-operator/crds/core.humio.com_humioscheduledsearches.yaml b/charts/humio-operator/crds/core.humio.com_humioscheduledsearches.yaml index 5cbec6f9..3b25257a 100644 --- a/charts/humio-operator/crds/core.humio.com_humioscheduledsearches.yaml +++ b/charts/humio-operator/crds/core.humio.com_humioscheduledsearches.yaml @@ -81,6 +81,7 @@ spec: type: string name: description: Name is the name of the scheduled search inside Humio + minLength: 1 type: string queryEnd: description: QueryEnd is the end of the relative time interval for @@ -104,6 +105,7 @@ spec: viewName: description: ViewName is the name of the Humio View under which the scheduled search will be managed. This can also be a Repository + minLength: 1 type: string required: - actions diff --git a/charts/humio-operator/crds/core.humio.com_humioviews.yaml b/charts/humio-operator/crds/core.humio.com_humioviews.yaml index 5cf7950a..3afa6f83 100644 --- a/charts/humio-operator/crds/core.humio.com_humioviews.yaml +++ b/charts/humio-operator/crds/core.humio.com_humioviews.yaml @@ -66,6 +66,7 @@ spec: repositoryName: description: RepositoryName contains the name of the target repository + minLength: 1 type: string type: object type: array @@ -86,7 +87,10 @@ spec: type: string name: description: Name is the name of the view inside Humio + minLength: 1 type: string + required: + - name type: object status: description: HumioViewStatus defines the observed state of HumioView diff --git a/config/crd/bases/core.humio.com_humioactions.yaml b/config/crd/bases/core.humio.com_humioactions.yaml index 275ad98a..8c994d56 100644 --- a/config/crd/bases/core.humio.com_humioactions.yaml +++ b/config/crd/bases/core.humio.com_humioactions.yaml @@ -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, @@ -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, @@ -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 @@ -392,6 +395,8 @@ spec: type: object x-kubernetes-map-type: atomic type: object + required: + - name type: object type: array url: diff --git a/config/crd/bases/core.humio.com_humioaggregatealerts.yaml b/config/crd/bases/core.humio.com_humioaggregatealerts.yaml index 7fd4369f..a57674cb 100644 --- a/config/crd/bases/core.humio.com_humioaggregatealerts.yaml +++ b/config/crd/bases/core.humio.com_humioaggregatealerts.yaml @@ -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 @@ -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 diff --git a/config/crd/bases/core.humio.com_humioalerts.yaml b/config/crd/bases/core.humio.com_humioalerts.yaml index 2dbc7e8e..8727804a 100644 --- a/config/crd/bases/core.humio.com_humioalerts.yaml +++ b/config/crd/bases/core.humio.com_humioalerts.yaml @@ -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 @@ -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 diff --git a/config/crd/bases/core.humio.com_humioclusters.yaml b/config/crd/bases/core.humio.com_humioclusters.yaml index 8e03ec5f..71156207 100644 --- a/config/crd/bases/core.humio.com_humioclusters.yaml +++ b/config/crd/bases/core.humio.com_humioclusters.yaml @@ -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: @@ -13117,6 +13116,8 @@ spec: type: string type: object type: object + required: + - name type: object type: array nodeUUIDPrefix: @@ -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: diff --git a/config/crd/bases/core.humio.com_humioexternalclusters.yaml b/config/crd/bases/core.humio.com_humioexternalclusters.yaml index b60263f9..a444c86d 100644 --- a/config/crd/bases/core.humio.com_humioexternalclusters.yaml +++ b/config/crd/bases/core.humio.com_humioexternalclusters.yaml @@ -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 diff --git a/config/crd/bases/core.humio.com_humiofilteralerts.yaml b/config/crd/bases/core.humio.com_humiofilteralerts.yaml index 1a5107b9..eb43f8d3 100644 --- a/config/crd/bases/core.humio.com_humiofilteralerts.yaml +++ b/config/crd/bases/core.humio.com_humiofilteralerts.yaml @@ -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 @@ -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 diff --git a/config/crd/bases/core.humio.com_humioingesttokens.yaml b/config/crd/bases/core.humio.com_humioingesttokens.yaml index 4632eda0..4c84b242 100644 --- a/config/crd/bases/core.humio.com_humioingesttokens.yaml +++ b/config/crd/bases/core.humio.com_humioingesttokens.yaml @@ -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: diff --git a/config/crd/bases/core.humio.com_humioparsers.yaml b/config/crd/bases/core.humio.com_humioparsers.yaml index acf7ba2f..ffc8710c 100644 --- a/config/crd/bases/core.humio.com_humioparsers.yaml +++ b/config/crd/bases/core.humio.com_humioparsers.yaml @@ -63,6 +63,7 @@ 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 @@ -70,6 +71,7 @@ spec: repositoryName: description: RepositoryName defines what repository this parser should be managed in + minLength: 1 type: string tagFields: description: |- @@ -84,6 +86,8 @@ spec: items: type: string type: array + required: + - name type: object status: description: HumioParserStatus defines the observed state of HumioParser diff --git a/config/crd/bases/core.humio.com_humiorepositories.yaml b/config/crd/bases/core.humio.com_humiorepositories.yaml index 08244fb4..7696676f 100644 --- a/config/crd/bases/core.humio.com_humiorepositories.yaml +++ b/config/crd/bases/core.humio.com_humiorepositories.yaml @@ -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 @@ -94,6 +95,8 @@ spec: format: int32 type: integer type: object + required: + - name type: object status: description: HumioRepositoryStatus defines the observed state of HumioRepository diff --git a/config/crd/bases/core.humio.com_humioscheduledsearches.yaml b/config/crd/bases/core.humio.com_humioscheduledsearches.yaml index 5cbec6f9..3b25257a 100644 --- a/config/crd/bases/core.humio.com_humioscheduledsearches.yaml +++ b/config/crd/bases/core.humio.com_humioscheduledsearches.yaml @@ -81,6 +81,7 @@ spec: type: string name: description: Name is the name of the scheduled search inside Humio + minLength: 1 type: string queryEnd: description: QueryEnd is the end of the relative time interval for @@ -104,6 +105,7 @@ spec: viewName: description: ViewName is the name of the Humio View under which the scheduled search will be managed. This can also be a Repository + minLength: 1 type: string required: - actions diff --git a/config/crd/bases/core.humio.com_humioviews.yaml b/config/crd/bases/core.humio.com_humioviews.yaml index 5cf7950a..3afa6f83 100644 --- a/config/crd/bases/core.humio.com_humioviews.yaml +++ b/config/crd/bases/core.humio.com_humioviews.yaml @@ -66,6 +66,7 @@ spec: repositoryName: description: RepositoryName contains the name of the target repository + minLength: 1 type: string type: object type: array @@ -86,7 +87,10 @@ spec: type: string name: description: Name is the name of the view inside Humio + minLength: 1 type: string + required: + - name type: object status: description: HumioViewStatus defines the observed state of HumioView diff --git a/controllers/suite/clusters/suite_test.go b/controllers/suite/clusters/suite_test.go index 90b52ae1..727b4cf0 100644 --- a/controllers/suite/clusters/suite_test.go +++ b/controllers/suite/clusters/suite_test.go @@ -271,6 +271,9 @@ var _ = ReportAfterSuite("HumioCluster Controller Suite", func(suiteReport ginkg u, _ := json.Marshal(r) fmt.Println(string(u)) } + if len(suiteReport.SpecialSuiteFailureReasons) > 0 { + fmt.Printf("SpecialSuiteFailureReasons: %+v", suiteReport.SpecialSuiteFailureReasons) + } }) var _ = ReportAfterEach(func(specReport ginkgotypes.SpecReport) { diff --git a/pkg/humio/client_mock.go b/pkg/humio/client_mock.go index caf688cb..c1720528 100644 --- a/pkg/humio/client_mock.go +++ b/pkg/humio/client_mock.go @@ -962,6 +962,9 @@ func (h *MockClientConfig) searchDomainNameExists(clusterName, searchDomainName } func (h *MockClientConfig) ListAllHumioUsersInCurrentOrganization(config *humioapi.Config, req reconcile.Request) ([]user, error) { + humioClientMu.Lock() + defer humioClientMu.Unlock() + key := resourceKey{ resourceName: fmt.Sprintf("%s%s", req.Namespace, req.Name), }