diff --git a/config/v1alpha1/tests/insightsdatagathers.config.openshift.io/InsightsConfig.yaml b/config/v1alpha1/tests/insightsdatagathers.config.openshift.io/InsightsConfig.yaml index 64fab0c3ddd..e88e521196d 100644 --- a/config/v1alpha1/tests/insightsdatagathers.config.openshift.io/InsightsConfig.yaml +++ b/config/v1alpha1/tests/insightsdatagathers.config.openshift.io/InsightsConfig.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if w name: "[TechPreview] InsightsDataGather" crdName: insightsdatagathers.config.openshift.io featureGates: -- InsightsConfig + - InsightsConfig tests: onCreate: - name: Should be able to create a minimal InsightsDataGather @@ -14,3 +14,145 @@ tests: apiVersion: config.openshift.io/v1alpha1 kind: InsightsDataGather spec: {} + - name: Should be able to create InsightsDataGather with a storage and PersistentVolume + initial: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + dataPolicy: None + storage: + type: PersistentVolume + persistentVolume: + mountPath: /data + claim: + name: test-claim + expected: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + dataPolicy: None + storage: + type: PersistentVolume + persistentVolume: + mountPath: /data + claim: + name: test-claim + - name: Should be able to create InsightsDataGather with a storage and Ephemeral + initial: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + dataPolicy: None + storage: + type: Ephemeral + expected: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + dataPolicy: None + storage: + type: Ephemeral + - name: Should be able to create InsightsDataGather with valid DisabledGatherers names + initial: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + disabledGatherers: + - gatherer + - valid_gatherer + - gatherer/function + - gatherer_a/function_a + expected: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + disabledGatherers: + - gatherer + - valid_gatherer + - gatherer/function + - gatherer_a/function_a + - name: When storage.type is PersistentVolume then PersistentVolume must be present + initial: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + storage: + type: PersistentVolume + expectedError: 'spec.gatherConfig.storage: Invalid value: "object": persistentVolume is required when type is PersistentVolume, and forbidden otherwise' + - name: When storage.type is not PersistentVolume then PersistentVolume must not be present + initial: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + storage: + type: Ephemeral + persistentVolume: + claim: + name: test-claim + expectedError: 'spec.gatherConfig.storage: Invalid value: "object": persistentVolume is required when type is PersistentVolume, and forbidden otherwise' + - name: mountPath must not contain colon + initial: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + storage: + type: PersistentVolume + persistentVolume: + mountPath: /data:/data + claim: + name: test-claim + expectedError: 'spec.gatherConfig.storage.persistentVolume.mountPath: Invalid value: "string": mountPath must not contain a colon' + - name: invalid disabledGatherers name + initial: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + disabledGatherers: + - invalid_gatherer_1 + expectedError: 'Invalid value: "string": disabledGatherer must be in the format of {gatherer}/{function} where the gatherer and function are lowercase letters only that may include underscores (_) and are separated by a forward slash (/) if the function is provided' + - name: storage.type is required + initial: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + storage: + persistentVolume: + mountPath: /data + claim: + name: test-claim + expectedError: "spec.gatherConfig.storage.type: Required value" + - name: storage.persistentVolume.claim can not be empty + initial: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + storage: + type: PersistentVolume + persistentVolume: + mountPath: /data + claim: + expectedError: "spec.gatherConfig.storage.persistentVolume.claim: Required value" + - name: claim must follow the naming convention + initial: | + apiVersion: config.openshift.io/v1alpha1 + kind: InsightsDataGather + spec: + gatherConfig: + storage: + type: PersistentVolume + persistentVolume: + claim: + name: INVALID_PVC_NAME + expectedError: 'Invalid value: "string": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, ''-'' or ''.'', and must start and end with an alphanumeric character.' diff --git a/config/v1alpha1/types_insights.go b/config/v1alpha1/types_insights.go index 3ae4de157cf..46666ae3b23 100644 --- a/config/v1alpha1/types_insights.go +++ b/config/v1alpha1/types_insights.go @@ -32,33 +32,97 @@ type InsightsDataGather struct { } type InsightsDataGatherSpec struct { - // gatherConfig spec attribute includes all the configuration options related to - // gathering of the Insights data and its uploading to the ingress. + // gatherConfig spec attribute includes all the configuration options related to gathering of the Insights data and its uploading to the ingress. // +optional GatherConfig GatherConfig `json:"gatherConfig,omitempty"` } -type InsightsDataGatherStatus struct { -} +type InsightsDataGatherStatus struct{} // gatherConfig provides data gathering configuration options. type GatherConfig struct { - // dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain - // in the Insights archive data. Valid values are "None" and "ObfuscateNetworking". + // dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain in the Insights archive data. + // Valid values are "None" and "ObfuscateNetworking". // When set to None the data is not obfuscated. // When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated. // When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. - // The current default is None. // +optional DataPolicy DataPolicy `json:"dataPolicy,omitempty"` // disabledGatherers is a list of gatherers to be excluded from the gathering. All the gatherers can be disabled by providing "all" value. // If all the gatherers are disabled, the Insights operator does not gather any data. + // The format for the disabledGatherer should be: {gatherer}/{function} where the function is optional. + // Gatherer consists of a lowercase letters only that may include underscores (_). + // Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). // The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. // Run the following command to get the names of last active gatherers: // "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'" // An example of disabling gatherers looks like this: `disabledGatherers: ["clusterconfig/machine_configs", "workloads/workload_info"]` + // +kubebuilder:validation:MaxItems=100 + // +optional + DisabledGatherers []DisabledGatherer `json:"disabledGatherers"` + // storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. + // If omitted, the gathering job will use ephemeral storage. + // +optional + StorageSpec *Storage `json:"storage,omitempty"` +} + +// disabledGatherer is a string that represents a gatherer that should be disabled +// +kubebuilder:validation:MaxLength=256 +// +kubebuilder:validation:XValidation:rule=`self.matches("^[a-z]+[_a-z]*[a-z]([/a-z][_a-z]*)?[a-z]$")`,message=`disabledGatherer must be in the format of {gatherer}/{function} where the gatherer and function are lowercase letters only that may include underscores (_) and are separated by a forward slash (/) if the function is provided` +type DisabledGatherer string + +// storage provides persistent storage configuration options for gathering jobs. +// If the type is set to PersistentVolume, then the PersistentVolume must be defined. +// If the type is set to Ephemeral, then the PersistentVolume must not be defined. +// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'PersistentVolume' ? has(self.persistentVolume) : !has(self.persistentVolume)",message="persistentVolume is required when type is PersistentVolume, and forbidden otherwise" +type Storage struct { + // type is a required field that specifies the type of storage that will be used to store the Insights data archive. + // Valid values are "PersistentVolume" and "Ephemeral". + // When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. + // When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the persistentVolume field. + // +required + Type StorageType `json:"type"` + // persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. + // The PersistentVolume must be created in the openshift-insights namespace. // +optional - DisabledGatherers []string `json:"disabledGatherers"` + PersistentVolume *PersistentVolumeConfig `json:"persistentVolume,omitempty"` +} + +// storageType declares valid storage types +// +kubebuilder:validation:Enum=PersistentVolume;Ephemeral +type StorageType string + +const ( + // StorageTypePersistentVolume storage type + StorageTypePersistentVolume StorageType = "PersistentVolume" + // StorageTypeEphemeral storage type + StorageTypeEphemeral StorageType = "Ephemeral" +) + +// persistentVolumeConfig provides configuration options for PersistentVolume storage. +type PersistentVolumeConfig struct { + // claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. + // The PersistentVolumeClaim must be created in the openshift-insights namespace. + // +required + Claim PersistentVolumeClaimReference `json:"claim"` + // mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. + // When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. + // The current default mount path is /var/lib/insights-operator + // The path may not exceed 1024 characters and must not contain a colon. + // +kubebuilder:validation:MaxLength=1024 + // +kubebuilder:validation:XValidation:rule="!self.contains(':')",message="mountPath must not contain a colon" + // +optional + MountPath string `json:"mountPath,omitempty"` +} + +// persistentVolumeClaimReference is a reference to a PersistentVolumeClaim. +type PersistentVolumeClaimReference struct { + // name is a string that follows the DNS1123 subdomain format. + // It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character. + // +kubebuilder:validation:XValidation:rule="!format.dns1123Subdomain().validate(self).hasValue()",message="a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character." + // +kubebuilder:validation:MaxLength:=253 + // +required + Name string `json:"name"` } const ( diff --git a/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-CustomNoUpgrade.crd.yaml b/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-CustomNoUpgrade.crd.yaml index 0c4aa9a2d2e..52660964766 100644 --- a/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-CustomNoUpgrade.crd.yaml +++ b/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-CustomNoUpgrade.crd.yaml @@ -46,18 +46,17 @@ spec: description: spec holds user settable values for configuration properties: gatherConfig: - description: |- - gatherConfig spec attribute includes all the configuration options related to - gathering of the Insights data and its uploading to the ingress. + description: gatherConfig spec attribute includes all the configuration + options related to gathering of the Insights data and its uploading + to the ingress. properties: dataPolicy: description: |- - dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain - in the Insights archive data. Valid values are "None" and "ObfuscateNetworking". + dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain in the Insights archive data. + Valid values are "None" and "ObfuscateNetworking". When set to None the data is not obfuscated. When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. - The current default is None. enum: - "" - None @@ -67,13 +66,88 @@ spec: description: |- disabledGatherers is a list of gatherers to be excluded from the gathering. All the gatherers can be disabled by providing "all" value. If all the gatherers are disabled, the Insights operator does not gather any data. + The format for the disabledGatherer should be: {gatherer}/{function} where the function is optional. + Gatherer consists of a lowercase letters only that may include underscores (_). + Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'" An example of disabling gatherers looks like this: `disabledGatherers: ["clusterconfig/machine_configs", "workloads/workload_info"]` items: + description: disabledGatherer is a string that represents a + gatherer that should be disabled + maxLength: 256 type: string + x-kubernetes-validations: + - message: disabledGatherer must be in the format of {gatherer}/{function} + where the gatherer and function are lowercase letters only + that may include underscores (_) and are separated by a + forward slash (/) if the function is provided + rule: self.matches("^[a-z]+[_a-z]*[a-z]([/a-z][_a-z]*)?[a-z]$") + maxItems: 100 type: array + storage: + description: |- + storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. + If omitted, the gathering job will use ephemeral storage. + properties: + persistentVolume: + description: |- + persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. + The PersistentVolume must be created in the openshift-insights namespace. + properties: + claim: + description: |- + claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. + The PersistentVolumeClaim must be created in the openshift-insights namespace. + properties: + name: + description: |- + name is a string that follows the DNS1123 subdomain format. + It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character. + maxLength: 253 + type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist + of lower case alphanumeric characters, '-' or + '.', and must start and end with an alphanumeric + character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' + required: + - name + type: object + mountPath: + description: |- + mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. + When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. + The current default mount path is /var/lib/insights-operator + The path may not exceed 1024 characters and must not contain a colon. + maxLength: 1024 + type: string + x-kubernetes-validations: + - message: mountPath must not contain a colon + rule: '!self.contains('':'')' + required: + - claim + type: object + type: + description: |- + type is a required field that specifies the type of storage that will be used to store the Insights data archive. + Valid values are "PersistentVolume" and "Ephemeral". + When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. + When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the persistentVolume field. + enum: + - PersistentVolume + - Ephemeral + type: string + required: + - type + type: object + x-kubernetes-validations: + - message: persistentVolume is required when type is PersistentVolume, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''PersistentVolume'' ? has(self.persistentVolume) + : !has(self.persistentVolume)' type: object type: object status: diff --git a/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-DevPreviewNoUpgrade.crd.yaml b/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-DevPreviewNoUpgrade.crd.yaml index 6665a1b597f..2e79b1a5353 100644 --- a/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-DevPreviewNoUpgrade.crd.yaml +++ b/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-DevPreviewNoUpgrade.crd.yaml @@ -46,18 +46,17 @@ spec: description: spec holds user settable values for configuration properties: gatherConfig: - description: |- - gatherConfig spec attribute includes all the configuration options related to - gathering of the Insights data and its uploading to the ingress. + description: gatherConfig spec attribute includes all the configuration + options related to gathering of the Insights data and its uploading + to the ingress. properties: dataPolicy: description: |- - dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain - in the Insights archive data. Valid values are "None" and "ObfuscateNetworking". + dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain in the Insights archive data. + Valid values are "None" and "ObfuscateNetworking". When set to None the data is not obfuscated. When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. - The current default is None. enum: - "" - None @@ -67,13 +66,88 @@ spec: description: |- disabledGatherers is a list of gatherers to be excluded from the gathering. All the gatherers can be disabled by providing "all" value. If all the gatherers are disabled, the Insights operator does not gather any data. + The format for the disabledGatherer should be: {gatherer}/{function} where the function is optional. + Gatherer consists of a lowercase letters only that may include underscores (_). + Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'" An example of disabling gatherers looks like this: `disabledGatherers: ["clusterconfig/machine_configs", "workloads/workload_info"]` items: + description: disabledGatherer is a string that represents a + gatherer that should be disabled + maxLength: 256 type: string + x-kubernetes-validations: + - message: disabledGatherer must be in the format of {gatherer}/{function} + where the gatherer and function are lowercase letters only + that may include underscores (_) and are separated by a + forward slash (/) if the function is provided + rule: self.matches("^[a-z]+[_a-z]*[a-z]([/a-z][_a-z]*)?[a-z]$") + maxItems: 100 type: array + storage: + description: |- + storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. + If omitted, the gathering job will use ephemeral storage. + properties: + persistentVolume: + description: |- + persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. + The PersistentVolume must be created in the openshift-insights namespace. + properties: + claim: + description: |- + claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. + The PersistentVolumeClaim must be created in the openshift-insights namespace. + properties: + name: + description: |- + name is a string that follows the DNS1123 subdomain format. + It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character. + maxLength: 253 + type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist + of lower case alphanumeric characters, '-' or + '.', and must start and end with an alphanumeric + character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' + required: + - name + type: object + mountPath: + description: |- + mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. + When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. + The current default mount path is /var/lib/insights-operator + The path may not exceed 1024 characters and must not contain a colon. + maxLength: 1024 + type: string + x-kubernetes-validations: + - message: mountPath must not contain a colon + rule: '!self.contains('':'')' + required: + - claim + type: object + type: + description: |- + type is a required field that specifies the type of storage that will be used to store the Insights data archive. + Valid values are "PersistentVolume" and "Ephemeral". + When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. + When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the persistentVolume field. + enum: + - PersistentVolume + - Ephemeral + type: string + required: + - type + type: object + x-kubernetes-validations: + - message: persistentVolume is required when type is PersistentVolume, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''PersistentVolume'' ? has(self.persistentVolume) + : !has(self.persistentVolume)' type: object type: object status: diff --git a/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-TechPreviewNoUpgrade.crd.yaml b/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-TechPreviewNoUpgrade.crd.yaml index 04e09c40a5c..ea47205b5fc 100644 --- a/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-TechPreviewNoUpgrade.crd.yaml +++ b/config/v1alpha1/zz_generated.crd-manifests/0000_10_config-operator_01_insightsdatagathers-TechPreviewNoUpgrade.crd.yaml @@ -46,18 +46,17 @@ spec: description: spec holds user settable values for configuration properties: gatherConfig: - description: |- - gatherConfig spec attribute includes all the configuration options related to - gathering of the Insights data and its uploading to the ingress. + description: gatherConfig spec attribute includes all the configuration + options related to gathering of the Insights data and its uploading + to the ingress. properties: dataPolicy: description: |- - dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain - in the Insights archive data. Valid values are "None" and "ObfuscateNetworking". + dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain in the Insights archive data. + Valid values are "None" and "ObfuscateNetworking". When set to None the data is not obfuscated. When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. - The current default is None. enum: - "" - None @@ -67,13 +66,88 @@ spec: description: |- disabledGatherers is a list of gatherers to be excluded from the gathering. All the gatherers can be disabled by providing "all" value. If all the gatherers are disabled, the Insights operator does not gather any data. + The format for the disabledGatherer should be: {gatherer}/{function} where the function is optional. + Gatherer consists of a lowercase letters only that may include underscores (_). + Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'" An example of disabling gatherers looks like this: `disabledGatherers: ["clusterconfig/machine_configs", "workloads/workload_info"]` items: + description: disabledGatherer is a string that represents a + gatherer that should be disabled + maxLength: 256 type: string + x-kubernetes-validations: + - message: disabledGatherer must be in the format of {gatherer}/{function} + where the gatherer and function are lowercase letters only + that may include underscores (_) and are separated by a + forward slash (/) if the function is provided + rule: self.matches("^[a-z]+[_a-z]*[a-z]([/a-z][_a-z]*)?[a-z]$") + maxItems: 100 type: array + storage: + description: |- + storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. + If omitted, the gathering job will use ephemeral storage. + properties: + persistentVolume: + description: |- + persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. + The PersistentVolume must be created in the openshift-insights namespace. + properties: + claim: + description: |- + claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. + The PersistentVolumeClaim must be created in the openshift-insights namespace. + properties: + name: + description: |- + name is a string that follows the DNS1123 subdomain format. + It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character. + maxLength: 253 + type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist + of lower case alphanumeric characters, '-' or + '.', and must start and end with an alphanumeric + character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' + required: + - name + type: object + mountPath: + description: |- + mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. + When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. + The current default mount path is /var/lib/insights-operator + The path may not exceed 1024 characters and must not contain a colon. + maxLength: 1024 + type: string + x-kubernetes-validations: + - message: mountPath must not contain a colon + rule: '!self.contains('':'')' + required: + - claim + type: object + type: + description: |- + type is a required field that specifies the type of storage that will be used to store the Insights data archive. + Valid values are "PersistentVolume" and "Ephemeral". + When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. + When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the persistentVolume field. + enum: + - PersistentVolume + - Ephemeral + type: string + required: + - type + type: object + x-kubernetes-validations: + - message: persistentVolume is required when type is PersistentVolume, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''PersistentVolume'' ? has(self.persistentVolume) + : !has(self.persistentVolume)' type: object type: object status: diff --git a/config/v1alpha1/zz_generated.deepcopy.go b/config/v1alpha1/zz_generated.deepcopy.go index 42ae69006eb..17d74e0fa85 100644 --- a/config/v1alpha1/zz_generated.deepcopy.go +++ b/config/v1alpha1/zz_generated.deepcopy.go @@ -353,9 +353,14 @@ func (in *GatherConfig) DeepCopyInto(out *GatherConfig) { *out = *in if in.DisabledGatherers != nil { in, out := &in.DisabledGatherers, &out.DisabledGatherers - *out = make([]string, len(*in)) + *out = make([]DisabledGatherer, len(*in)) copy(*out, *in) } + if in.StorageSpec != nil { + in, out := &in.StorageSpec, &out.StorageSpec + *out = new(Storage) + (*in).DeepCopyInto(*out) + } return } @@ -612,6 +617,39 @@ func (in *PKICertificateSubject) DeepCopy() *PKICertificateSubject { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PersistentVolumeClaimReference) DeepCopyInto(out *PersistentVolumeClaimReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersistentVolumeClaimReference. +func (in *PersistentVolumeClaimReference) DeepCopy() *PersistentVolumeClaimReference { + if in == nil { + return nil + } + out := new(PersistentVolumeClaimReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PersistentVolumeConfig) DeepCopyInto(out *PersistentVolumeConfig) { + *out = *in + out.Claim = in.Claim + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersistentVolumeConfig. +func (in *PersistentVolumeConfig) DeepCopy() *PersistentVolumeConfig { + if in == nil { + return nil + } + out := new(PersistentVolumeConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Policy) DeepCopyInto(out *Policy) { *out = *in @@ -819,6 +857,27 @@ func (in *RetentionSizeConfig) DeepCopy() *RetentionSizeConfig { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Storage) DeepCopyInto(out *Storage) { + *out = *in + if in.PersistentVolume != nil { + in, out := &in.PersistentVolume, &out.PersistentVolume + *out = new(PersistentVolumeConfig) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Storage. +func (in *Storage) DeepCopy() *Storage { + if in == nil { + return nil + } + out := new(Storage) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *UserDefinedMonitoring) DeepCopyInto(out *UserDefinedMonitoring) { *out = *in diff --git a/config/v1alpha1/zz_generated.featuregated-crd-manifests/insightsdatagathers.config.openshift.io/InsightsConfig.yaml b/config/v1alpha1/zz_generated.featuregated-crd-manifests/insightsdatagathers.config.openshift.io/InsightsConfig.yaml index 8a73423c7d5..2ae5b91fb29 100644 --- a/config/v1alpha1/zz_generated.featuregated-crd-manifests/insightsdatagathers.config.openshift.io/InsightsConfig.yaml +++ b/config/v1alpha1/zz_generated.featuregated-crd-manifests/insightsdatagathers.config.openshift.io/InsightsConfig.yaml @@ -46,18 +46,17 @@ spec: description: spec holds user settable values for configuration properties: gatherConfig: - description: |- - gatherConfig spec attribute includes all the configuration options related to - gathering of the Insights data and its uploading to the ingress. + description: gatherConfig spec attribute includes all the configuration + options related to gathering of the Insights data and its uploading + to the ingress. properties: dataPolicy: description: |- - dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain - in the Insights archive data. Valid values are "None" and "ObfuscateNetworking". + dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain in the Insights archive data. + Valid values are "None" and "ObfuscateNetworking". When set to None the data is not obfuscated. When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. - The current default is None. enum: - "" - None @@ -67,13 +66,88 @@ spec: description: |- disabledGatherers is a list of gatherers to be excluded from the gathering. All the gatherers can be disabled by providing "all" value. If all the gatherers are disabled, the Insights operator does not gather any data. + The format for the disabledGatherer should be: {gatherer}/{function} where the function is optional. + Gatherer consists of a lowercase letters only that may include underscores (_). + Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'" An example of disabling gatherers looks like this: `disabledGatherers: ["clusterconfig/machine_configs", "workloads/workload_info"]` items: + description: disabledGatherer is a string that represents a + gatherer that should be disabled + maxLength: 256 type: string + x-kubernetes-validations: + - message: disabledGatherer must be in the format of {gatherer}/{function} + where the gatherer and function are lowercase letters only + that may include underscores (_) and are separated by a + forward slash (/) if the function is provided + rule: self.matches("^[a-z]+[_a-z]*[a-z]([/a-z][_a-z]*)?[a-z]$") + maxItems: 100 type: array + storage: + description: |- + storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. + If omitted, the gathering job will use ephemeral storage. + properties: + persistentVolume: + description: |- + persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. + The PersistentVolume must be created in the openshift-insights namespace. + properties: + claim: + description: |- + claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. + The PersistentVolumeClaim must be created in the openshift-insights namespace. + properties: + name: + description: |- + name is a string that follows the DNS1123 subdomain format. + It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character. + maxLength: 253 + type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist + of lower case alphanumeric characters, '-' or + '.', and must start and end with an alphanumeric + character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' + required: + - name + type: object + mountPath: + description: |- + mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. + When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. + The current default mount path is /var/lib/insights-operator + The path may not exceed 1024 characters and must not contain a colon. + maxLength: 1024 + type: string + x-kubernetes-validations: + - message: mountPath must not contain a colon + rule: '!self.contains('':'')' + required: + - claim + type: object + type: + description: |- + type is a required field that specifies the type of storage that will be used to store the Insights data archive. + Valid values are "PersistentVolume" and "Ephemeral". + When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. + When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the persistentVolume field. + enum: + - PersistentVolume + - Ephemeral + type: string + required: + - type + type: object + x-kubernetes-validations: + - message: persistentVolume is required when type is PersistentVolume, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''PersistentVolume'' ? has(self.persistentVolume) + : !has(self.persistentVolume)' type: object type: object status: diff --git a/config/v1alpha1/zz_generated.swagger_doc_generated.go b/config/v1alpha1/zz_generated.swagger_doc_generated.go index 65da579c4a0..504281540b9 100644 --- a/config/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/config/v1alpha1/zz_generated.swagger_doc_generated.go @@ -307,8 +307,9 @@ func (PublicKey) SwaggerDoc() map[string]string { var map_GatherConfig = map[string]string{ "": "gatherConfig provides data gathering configuration options.", - "dataPolicy": "dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain in the Insights archive data. Valid values are \"None\" and \"ObfuscateNetworking\". When set to None the data is not obfuscated. When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The current default is None.", - "disabledGatherers": "disabledGatherers is a list of gatherers to be excluded from the gathering. All the gatherers can be disabled by providing \"all\" value. If all the gatherers are disabled, the Insights operator does not gather any data. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: \"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'\" An example of disabling gatherers looks like this: `disabledGatherers: [\"clusterconfig/machine_configs\", \"workloads/workload_info\"]`", + "dataPolicy": "dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain in the Insights archive data. Valid values are \"None\" and \"ObfuscateNetworking\". When set to None the data is not obfuscated. When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.", + "disabledGatherers": "disabledGatherers is a list of gatherers to be excluded from the gathering. All the gatherers can be disabled by providing \"all\" value. If all the gatherers are disabled, the Insights operator does not gather any data. The format for the disabledGatherer should be: {gatherer}/{function} where the function is optional. Gatherer consists of a lowercase letters only that may include underscores (_). Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: \"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'\" An example of disabling gatherers looks like this: `disabledGatherers: [\"clusterconfig/machine_configs\", \"workloads/workload_info\"]`", + "storage": "storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. If omitted, the gathering job will use ephemeral storage.", } func (GatherConfig) SwaggerDoc() map[string]string { @@ -343,4 +344,33 @@ func (InsightsDataGatherSpec) SwaggerDoc() map[string]string { return map_InsightsDataGatherSpec } +var map_PersistentVolumeClaimReference = map[string]string{ + "": "persistentVolumeClaimReference is a reference to a PersistentVolumeClaim.", + "name": "name is a string that follows the DNS1123 subdomain format. It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character.", +} + +func (PersistentVolumeClaimReference) SwaggerDoc() map[string]string { + return map_PersistentVolumeClaimReference +} + +var map_PersistentVolumeConfig = map[string]string{ + "": "persistentVolumeConfig provides configuration options for PersistentVolume storage.", + "claim": "claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. The PersistentVolumeClaim must be created in the openshift-insights namespace.", + "mountPath": "mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The current default mount path is /var/lib/insights-operator The path may not exceed 1024 characters and must not contain a colon.", +} + +func (PersistentVolumeConfig) SwaggerDoc() map[string]string { + return map_PersistentVolumeConfig +} + +var map_Storage = map[string]string{ + "": "storage provides persistent storage configuration options for gathering jobs. If the type is set to PersistentVolume, then the PersistentVolume must be defined. If the type is set to Ephemeral, then the PersistentVolume must not be defined.", + "type": "type is a required field that specifies the type of storage that will be used to store the Insights data archive. Valid values are \"PersistentVolume\" and \"Ephemeral\". When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the persistentVolume field.", + "persistentVolume": "persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. The PersistentVolume must be created in the openshift-insights namespace.", +} + +func (Storage) SwaggerDoc() map[string]string { + return map_Storage +} + // AUTO-GENERATED FUNCTIONS END HERE diff --git a/insights/v1alpha1/tests/datagathers.insights.openshift.io/InsightsOnDemandDataGather.yaml b/insights/v1alpha1/tests/datagathers.insights.openshift.io/InsightsOnDemandDataGather.yaml index ef0c2cf1690..47760d64f32 100644 --- a/insights/v1alpha1/tests/datagathers.insights.openshift.io/InsightsOnDemandDataGather.yaml +++ b/insights/v1alpha1/tests/datagathers.insights.openshift.io/InsightsOnDemandDataGather.yaml @@ -2,7 +2,7 @@ apiVersion: apiextensions.k8s.io/v1 # Hack because controller-gen complains if w name: "[TechPreview] DataGather" crdName: datagathers.insights.openshift.io featureGates: -- InsightsOnDemandDataGather + - InsightsOnDemandDataGather tests: onCreate: - name: Should be able to create a minimal DataGather @@ -14,6 +14,104 @@ tests: apiVersion: insights.openshift.io/v1alpha1 kind: DataGather spec: {} + - name: Should be able to create a DataGather with a storage persistentVolume + initial: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: + storage: + type: PersistentVolume + persistentVolume: + mountPath: /data + claim: + name: test-claim + expected: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: + storage: + type: PersistentVolume + persistentVolume: + mountPath: /data + claim: + name: test-claim + - name: Should be able to create a DataGather with a storage Epemeral + initial: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: + storage: + type: Ephemeral + expected: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: + storage: + type: Ephemeral + - name: When storage.type is persistentVolume then PersistentVolume must be present + initial: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: + storage: + type: PersistentVolume + expectedError: 'spec.storage: Invalid value: "object": persistentVolume is required when type is PersistentVolume, and forbidden otherwise' + - name: When storage.type is not persistentVolume then PersistentVolume must not be present + initial: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: + storage: + type: Ephemeral + persistentVolume: + claim: + name: test-claim + expectedError: 'spec.storage: Invalid value: "object": persistentVolume is required when type is PersistentVolume, and forbidden otherwise' + - name: mountPath must not contain colon + initial: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: + storage: + type: PersistentVolume + persistentVolume: + mountPath: /data:/data + claim: + name: test-claim + expectedError: 'spec.storage.persistentVolume.mountPath: Invalid value: "string": mountPath must not contain a colon' + - name: storage.type is required + initial: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: + storage: + persistentVolume: + mountPath: /data + claim: + name: test-claim + expectedError: "spec.storage.type: Required value" + - name: storage.persistentVolume.claim can not be empty + initial: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: + storage: + type: PersistentVolume + persistentVolume: + mountPath: /data + claim: + expectedError: "spec.storage.persistentVolume.claim: Required value" + - name: persistentVolumeClaim must follow the naming convention + initial: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: + storage: + type: PersistentVolume + persistentVolume: + claim: + name: INVALID_PVC_NAME + expectedError: 'Invalid value: "string": a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, ''-'' or ''.'', and must start and end with an alphanumeric character.' onUpdate: - name: status is present and startTime is added initial: | @@ -50,7 +148,7 @@ tests: spec: {} # No spec is required for a DataGather status: insightsRequestID: xyz - expectedStatusError: "status: Invalid value: \"object\": cannot remove startTime attribute from status" + expectedStatusError: 'status: Invalid value: "object": cannot remove startTime attribute from status' - name: startTime is immutable once set initial: | apiVersion: insights.openshift.io/v1alpha1 @@ -66,8 +164,8 @@ tests: status: insightsRequestID: xyz startTime: 2023-03-13T12:34:06Z - expectedStatusError: "Invalid value: \"string\": startTime is immutable once set" - - name: Status is presentt and insightsRequestID is added + expectedStatusError: 'Invalid value: "string": startTime is immutable once set' + - name: Status is present and insightsRequestID is added initial: | apiVersion: insights.openshift.io/v1alpha1 kind: DataGather @@ -122,7 +220,7 @@ tests: group: "" resource: "pods" namespace: "openshift-insights" - expectedStatusError: "status: Invalid value: \"object\": cannot remove insightsRequestID attribute from status" + expectedStatusError: 'status: Invalid value: "object": cannot remove insightsRequestID attribute from status' - name: insightsRequestID is immutable once set initial: | apiVersion: insights.openshift.io/v1alpha1 @@ -146,7 +244,7 @@ tests: group: "" resource: "pods" namespace: "openshift-insights" - expectedStatusError: "Invalid value: \"string\": insightsRequestID is immutable once set" + expectedStatusError: 'Invalid value: "string": insightsRequestID is immutable once set' - name: finishTime cannot be removed from status initial: | apiVersion: insights.openshift.io/v1alpha1 @@ -169,7 +267,7 @@ tests: group: "" resource: "pods" namespace: "openshift-insights" - expectedStatusError: "status: Invalid value: \"object\": cannot remove finishTime attribute from status" + expectedStatusError: 'status: Invalid value: "object": cannot remove finishTime attribute from status' - name: dataGatherState cannot be removed from status initial: | apiVersion: insights.openshift.io/v1alpha1 @@ -187,7 +285,7 @@ tests: group: "" resource: "pods" namespace: "openshift-insights" - expectedStatusError: "status: Invalid value: \"object\": cannot remove dataGatherState attribute from status" + expectedStatusError: 'status: Invalid value: "object": cannot remove dataGatherState attribute from status' - name: dataGatherState cannot transition from Running to Pending initial: | apiVersion: insights.openshift.io/v1alpha1 @@ -201,7 +299,7 @@ tests: spec: {} # No spec is required for a DataGather status: dataGatherState: Pending - expectedStatusError: "status.dataGatherState: Invalid value: \"string\": dataGatherState cannot transition from Running to Pending" + expectedStatusError: 'status.dataGatherState: Invalid value: "string": dataGatherState cannot transition from Running to Pending' - name: dataGatherState cannot transition from Completed to Pending initial: | apiVersion: insights.openshift.io/v1alpha1 @@ -215,7 +313,7 @@ tests: spec: {} # No spec is required for a DataGather status: dataGatherState: Pending - expectedStatusError: "status.dataGatherState: Invalid value: \"string\": dataGatherState cannot transition from Completed to Pending" + expectedStatusError: 'status.dataGatherState: Invalid value: "string": dataGatherState cannot transition from Completed to Pending' - name: dataGatherState cannot transition from Failed to Pending initial: | apiVersion: insights.openshift.io/v1alpha1 @@ -229,7 +327,7 @@ tests: spec: {} # No spec is required for a DataGather status: dataGatherState: Pending - expectedStatusError: "status.dataGatherState: Invalid value: \"string\": dataGatherState cannot transition from Failed to Pending" + expectedStatusError: 'status.dataGatherState: Invalid value: "string": dataGatherState cannot transition from Failed to Pending' - name: dataGatherState cannot transition from Completed to Running initial: | apiVersion: insights.openshift.io/v1alpha1 @@ -243,7 +341,7 @@ tests: spec: {} # No spec is required for a DataGather status: dataGatherState: Running - expectedStatusError: "status.dataGatherState: Invalid value: \"string\": dataGatherState cannot transition from Completed to Running" + expectedStatusError: 'status.dataGatherState: Invalid value: "string": dataGatherState cannot transition from Completed to Running' - name: dataGatherState cannot transition from Failed to Running initial: | apiVersion: insights.openshift.io/v1alpha1 @@ -257,7 +355,7 @@ tests: spec: {} # No spec is required for a DataGather status: dataGatherState: Running - expectedStatusError: "status.dataGatherState: Invalid value: \"string\": dataGatherState cannot transition from Failed to Running" + expectedStatusError: 'status.dataGatherState: Invalid value: "string": dataGatherState cannot transition from Failed to Running' - name: lastGatherDuration can be updated with a trailing zero value initial: | apiVersion: insights.openshift.io/v1alpha1 @@ -324,7 +422,7 @@ tests: reason: OK message: "test message" lastTransitionTime: "2024-12-01T08:04:21Z" - - name: lastGatherDuration can be updated with a decimal number value + - name: lastGatherDuration can be updated with a decimal number value initial: | apiVersion: insights.openshift.io/v1alpha1 kind: DataGather @@ -357,7 +455,7 @@ tests: reason: OK message: "test message" lastTransitionTime: "2024-12-01T08:04:21Z" - - name: lastGatherDuration cannot be updated with an invalid value + - name: lastGatherDuration cannot be updated with an invalid value initial: | apiVersion: insights.openshift.io/v1alpha1 kind: DataGather @@ -377,7 +475,7 @@ tests: message: "test message" lastTransitionTime: "2024-12-01T08:04:21Z" expectedStatusError: "Invalid value: \"1d2h\": gatherers[0].lastGatherDuration in body should match '^(([0-9]+(?:\\.[0-9]+)?(ns|us|µs|μs|ms|s|m|h))+)$'" - - name: lastGatherDuration cannot be updated with a negative value + - name: lastGatherDuration cannot be updated with a negative value initial: | apiVersion: insights.openshift.io/v1alpha1 kind: DataGather @@ -397,3 +495,35 @@ tests: message: "test message" lastTransitionTime: "2024-12-01T08:04:21Z" expectedStatusError: "Invalid value: \"-0m5s\": gatherers[0].lastGatherDuration in body should match '^(([0-9]+(?:\\.[0-9]+)?(ns|us|µs|μs|ms|s|m|h))+)$'" + - name: should not be updated with URL that is not HTTPS + initial: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: {} # No spec is required for a DataGather + updated: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: {} # No spec is required for a DataGather + status: + insightsReport: + uri: http://example.com + expectedStatusError: 'status.insightsReport.uri: Invalid value: "string": URI must be a valid HTTPS URL (e.g., https://example.com)' + - name: should be updated with a valid HTTPS URL + initial: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: {} # No spec is required for a DataGather + updated: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: {} # No spec is required for a DataGather + status: + insightsReport: + uri: https://example.com + expected: | + apiVersion: insights.openshift.io/v1alpha1 + kind: DataGather + spec: {} # No spec is required for a DataGather + status: + insightsReport: + uri: https://example.com diff --git a/insights/v1alpha1/types_insights.go b/insights/v1alpha1/types_insights.go index d7d8930c955..677ab321ae0 100644 --- a/insights/v1alpha1/types_insights.go +++ b/insights/v1alpha1/types_insights.go @@ -23,11 +23,10 @@ import ( // +openshift:compatibility-gen:level=4 type DataGather struct { metav1.TypeMeta `json:",inline"` - // metadata is the standard object's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata + // +optional metav1.ObjectMeta `json:"metadata,omitempty"` - // spec holds user settable values for configuration // +required Spec DataGatherSpec `json:"spec"` @@ -46,12 +45,73 @@ type DataGatherSpec struct { // The current default is ClearText. // +optional DataPolicy DataPolicy `json:"dataPolicy"` - // gatherers is a list of gatherers configurations. + // gatherers is an optional list of gatherers configurations. + // The list must not exceed 100 items. // The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. // Run the following command to get the names of last active gatherers: // "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'" + // +kubebuilder:validation:MaxItems=100 // +optional - Gatherers []GathererConfig `json:"gatherers"` + Gatherers []GathererConfig `json:"gatherers,omitempty"` + // storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. + // If omitted, the gathering job will use ephemeral storage. + // +optional + Storage *Storage `json:"storage,omitempty"` +} + +// storage provides persistent storage configuration options for gathering jobs. +// If the type is set to PersistentVolume, then the PersistentVolume must be defined. +// If the type is set to Ephemeral, then the PersistentVolume must not be defined. +// +kubebuilder:validation:XValidation:rule="has(self.type) && self.type == 'PersistentVolume' ? has(self.persistentVolume) : !has(self.persistentVolume)",message="persistentVolume is required when type is PersistentVolume, and forbidden otherwise" +type Storage struct { + // type is a required field that specifies the type of storage that will be used to store the Insights data archive. + // Valid values are "PersistentVolume" and "Ephemeral". + // When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. + // When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is + // defined by the PersistentVolume field. + // +required + Type StorageType `json:"type"` + // persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. + // The PersistentVolume must be created in the openshift-insights namespace. + // +optional + PersistentVolume *PersistentVolumeConfig `json:"persistentVolume,omitempty"` +} + +// storageType declares valid storage types +// +kubebuilder:validation:Enum=PersistentVolume;Ephemeral +type StorageType string + +const ( + // StorageTypePersistentVolume storage type + StorageTypePersistentVolume StorageType = "PersistentVolume" + // StorageTypeEphemeral storage type + StorageTypeEphemeral StorageType = "Ephemeral" +) + +// persistentVolumeConfig provides configuration options for PersistentVolume storage. +type PersistentVolumeConfig struct { + // claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. + // The PersistentVolumeClaim must be created in the openshift-insights namespace. + // +required + Claim PersistentVolumeClaimReference `json:"claim"` + // mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. + // When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. + // The current default mount path is /var/lib/insights-operator + // The path may not exceed 1024 characters and must not contain a colon. + // +kubebuilder:validation:MaxLength=1024 + // +kubebuilder:validation:XValidation:rule="!self.contains(':')",message="mountPath must not contain a colon" + // +optional + MountPath string `json:"mountPath,omitempty"` +} + +// persistentVolumeClaimReference is a reference to a PersistentVolumeClaim. +type PersistentVolumeClaimReference struct { + // name is a string that follows the DNS1123 subdomain format. + // It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character. + // +kubebuilder:validation:XValidation:rule="!format.dns1123Subdomain().validate(self).hasValue()",message="a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character." + // +kubebuilder:validation:MaxLength:=253 + // +required + Name string `json:"name"` } const ( @@ -83,7 +143,14 @@ type GathererState string // gathererConfig allows to configure specific gatherers type GathererConfig struct { - // name is the name of specific gatherer + // name is the required name of specific gatherer + // It must be at most 256 characters in length. + // The format for the gatherer name should be: {gatherer}/{function} where the function is optional. + // Gatherer consists of a lowercase letters only that may include underscores (_). + // Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). + // The particular gatherers can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. + // +kubebuilder:validation:MaxLength=256 + // +kubebuilder:validation:XValidation:rule=`self.matches("^[a-z]+[_a-z]*[a-z]([/a-z][_a-z]*)?[a-z]$")`,message=`gatherer name must be in the format of {gatherer}/{function} where the gatherer and function are lowercase letters only that may include underscores (_) and are separated by a forward slash (/) if the function is provided` // +required Name string `json:"name"` // state allows you to configure specific gatherer. Valid values are "Enabled", "Disabled" and omitted. @@ -115,6 +182,7 @@ type DataGatherStatus struct { // +patchStrategy=merge // +listType=map // +listMapKey=type + // +kubebuilder:validation:MaxItems=100 // +optional Conditions []metav1.Condition `json:"conditions" patchStrategy:"merge" patchMergeKey:"type"` // dataGatherState reflects the current state of the data gathering process. @@ -123,6 +191,7 @@ type DataGatherStatus struct { // gatherers is a list of active gatherers (and their statuses) in the last gathering. // +listType=map // +listMapKey=name + // +kubebuilder:validation:MaxItems=100 // +optional Gatherers []GathererStatus `json:"gatherers,omitempty"` // startTime is the time when Insights data gathering started. @@ -135,11 +204,13 @@ type DataGatherStatus struct { FinishTime metav1.Time `json:"finishTime,omitempty"` // relatedObjects is a list of resources which are useful when debugging or inspecting the data // gathering Pod + // +kubebuilder:validation:MaxItems=100 // +optional RelatedObjects []ObjectReference `json:"relatedObjects,omitempty"` // insightsRequestID is an Insights request ID to track the status of the // Insights analysis (in console.redhat.com processing pipeline) for the corresponding Insights data archive. // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="insightsRequestID is immutable once set" + // +kubebuilder:validation:MaxLength=256 // +optional InsightsRequestID string `json:"insightsRequestID,omitempty"` // insightsReport provides general Insights analysis results. @@ -157,8 +228,9 @@ type GathererStatus struct { // +patchStrategy=merge // +listType=map // +listMapKey=type - // +required // +kubebuilder:validation:MinItems=1 + // +kubebuilder:validation:MaxItems=100 + // +required Conditions []metav1.Condition `json:"conditions" patchStrategy:"merge" patchMergeKey:"type"` // name is the name of the gatherer. // +required @@ -183,10 +255,13 @@ type InsightsReport struct { // healthChecks provides basic information about active Insights health checks // in a cluster. // +listType=atomic + // +kubebuilder:validation:MaxItems=100 // +optional HealthChecks []HealthCheck `json:"healthChecks,omitempty"` - // uri provides the URL link from which the report was downloaded. - // +kubebuilder:validation:Pattern=`^https:\/\/\S+` + // uri is optional field that provides the URL link from which the report was downloaded. + // The link must be a valid HTTPS URL and the maximum length is 2048 characters. + // +kubebuilder:validation:XValidation:rule=`isURL(self) && url(self).getScheme() == "https"`,message=`URI must be a valid HTTPS URL (e.g., https://example.com)` + // +kubebuilder:validation:MaxLength=2048 // +optional URI string `json:"uri,omitempty"` } @@ -205,9 +280,11 @@ type HealthCheck struct { // +kubebuilder:validation:Minimum=1 // +kubebuilder:validation:Maximum=4 TotalRisk int32 `json:"totalRisk"` - // advisorURI provides the URL link to the Insights Advisor. + // advisorURI is required field that provides the URL link to the Insights Advisor. + // The link must be a valid HTTPS URL and the maximum length is 2048 characters. + // +kubebuilder:validation:XValidation:rule=`isURL(self) && url(self).getScheme() == "https"`,message=`advisorURI must be a valid HTTPS URL (e.g., https://example.com)` + // +kubebuilder:validation:MaxLength=2048 // +required - // +kubebuilder:validation:Pattern=`^https:\/\/\S+` AdvisorURI string `json:"advisorURI"` // state determines what the current state of the health check is. // Health check is enabled by default and can be disabled @@ -232,22 +309,30 @@ const ( type ObjectReference struct { // group is the API Group of the Resource. // Enter empty string for the core group. - // This value should consist of only lowercase alphanumeric characters, hyphens and periods. + // This value is empty or should follow the DNS1123 subdomain format and it must be at most 253 characters in length. // Example: "", "apps", "build.openshift.io", etc. - // +kubebuilder:validation:Pattern:="^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$" + // +kubebuilder:validation:XValidation:rule="self.size() == 0 || !format.dns1123Subdomain().validate(self).hasValue()",message="a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character." + // +kubebuilder:validation:MaxLength:=253 // +required Group string `json:"group"` - // resource is the type that is being referenced. + // resource is required field of the type that is being referenced. // It is normally the plural form of the resource kind in lowercase. // This value should consist of only lowercase alphanumeric characters and hyphens. // Example: "deployments", "deploymentconfigs", "pods", etc. + // +kubebuilder:validation:XValidation:rule=`self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$")`,message=`resource must consist of only lowercase alphanumeric characters and hyphens` + // +kubebuilder:validation:MaxLength=512 // +required - // +kubebuilder:validation:Pattern:="^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" Resource string `json:"resource"` - // name of the referent. + // name of the referent that follows the DNS1123 subdomain format. + // It must be at most 256 characters in length. + // +kubebuilder:validation:XValidation:rule="!format.dns1123Subdomain().validate(self).hasValue()",message="a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character." + // +kubebuilder:validation:MaxLength=256 // +required Name string `json:"name"` - // namespace of the referent. + // namespace of the referent that follows the DNS1123 subdomain format. + // It must be at most 253 characters in length. + // +kubebuilder:validation:XValidation:rule="!format.dns1123Subdomain().validate(self).hasValue()",message="a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character." + // +kubebuilder:validation:MaxLength=253 // +optional Namespace string `json:"namespace,omitempty"` } @@ -260,11 +345,13 @@ type ObjectReference struct { // +openshift:compatibility-gen:level=4 type DataGatherList struct { metav1.TypeMeta `json:",inline"` - // metadata is the standard list's metadata. // More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata - metav1.ListMeta `json:"metadata"` - + // +optional + metav1.ListMeta `json:"metadata,omitempty"` // items contains a list of DataGather resources. - Items []DataGather `json:"items"` + // +listType=atomic + // +kubebuilder:validation:MaxItems=100 + // +optional + Items []DataGather `json:"items,omitempty"` } diff --git a/insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-CustomNoUpgrade.crd.yaml b/insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-CustomNoUpgrade.crd.yaml index b24dbfeb6ea..9f46b78396f 100644 --- a/insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-CustomNoUpgrade.crd.yaml +++ b/insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-CustomNoUpgrade.crd.yaml @@ -73,7 +73,8 @@ spec: type: string gatherers: description: |- - gatherers is a list of gatherers configurations. + gatherers is an optional list of gatherers configurations. + The list must not exceed 100 items. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'" @@ -81,8 +82,21 @@ spec: description: gathererConfig allows to configure specific gatherers properties: name: - description: name is the name of specific gatherer + description: |- + name is the required name of specific gatherer + It must be at most 256 characters in length. + The format for the gatherer name should be: {gatherer}/{function} where the function is optional. + Gatherer consists of a lowercase letters only that may include underscores (_). + Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). + The particular gatherers can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. + maxLength: 256 type: string + x-kubernetes-validations: + - message: gatherer name must be in the format of {gatherer}/{function} + where the gatherer and function are lowercase letters only + that may include underscores (_) and are separated by a + forward slash (/) if the function is provided + rule: self.matches("^[a-z]+[_a-z]*[a-z]([/a-z][_a-z]*)?[a-z]$") state: description: |- state allows you to configure specific gatherer. Valid values are "Enabled", "Disabled" and omitted. @@ -96,7 +110,70 @@ spec: required: - name type: object + maxItems: 100 type: array + storage: + description: |- + storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. + If omitted, the gathering job will use ephemeral storage. + properties: + persistentVolume: + description: |- + persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. + The PersistentVolume must be created in the openshift-insights namespace. + properties: + claim: + description: |- + claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. + The PersistentVolumeClaim must be created in the openshift-insights namespace. + properties: + name: + description: |- + name is a string that follows the DNS1123 subdomain format. + It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character. + maxLength: 253 + type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist + of lower case alphanumeric characters, '-' or '.', + and must start and end with an alphanumeric character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' + required: + - name + type: object + mountPath: + description: |- + mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. + When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. + The current default mount path is /var/lib/insights-operator + The path may not exceed 1024 characters and must not contain a colon. + maxLength: 1024 + type: string + x-kubernetes-validations: + - message: mountPath must not contain a colon + rule: '!self.contains('':'')' + required: + - claim + type: object + type: + description: |- + type is a required field that specifies the type of storage that will be used to store the Insights data archive. + Valid values are "PersistentVolume" and "Ephemeral". + When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. + When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is + defined by the PersistentVolume field. + enum: + - PersistentVolume + - Ephemeral + type: string + required: + - type + type: object + x-kubernetes-validations: + - message: persistentVolume is required when type is PersistentVolume, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''PersistentVolume'' ? has(self.persistentVolume) + : !has(self.persistentVolume)' type: object status: description: status holds observed values from the cluster. They may not @@ -159,6 +236,7 @@ spec: - status - type type: object + maxItems: 100 type: array x-kubernetes-list-map-keys: - type @@ -256,6 +334,7 @@ spec: - status - type type: object + maxItems: 100 minItems: 1 type: array x-kubernetes-list-map-keys: @@ -275,6 +354,7 @@ spec: - lastGatherDuration - name type: object + maxItems: 100 type: array x-kubernetes-list-map-keys: - name @@ -301,10 +381,14 @@ spec: attributes. properties: advisorURI: - description: advisorURI provides the URL link to the Insights - Advisor. - pattern: ^https:\/\/\S+ + description: |- + advisorURI is required field that provides the URL link to the Insights Advisor. + The link must be a valid HTTPS URL and the maximum length is 2048 characters. + maxLength: 2048 type: string + x-kubernetes-validations: + - message: advisorURI must be a valid HTTPS URL (e.g., https://example.com) + rule: isURL(self) && url(self).getScheme() == "https" description: description: description provides basic description of the healtcheck. @@ -335,18 +419,24 @@ spec: - state - totalRisk type: object + maxItems: 100 type: array x-kubernetes-list-type: atomic uri: - description: uri provides the URL link from which the report was - downloaded. - pattern: ^https:\/\/\S+ + description: |- + uri is optional field that provides the URL link from which the report was downloaded. + The link must be a valid HTTPS URL and the maximum length is 2048 characters. + maxLength: 2048 type: string + x-kubernetes-validations: + - message: URI must be a valid HTTPS URL (e.g., https://example.com) + rule: isURL(self) && url(self).getScheme() == "https" type: object insightsRequestID: description: |- insightsRequestID is an Insights request ID to track the status of the Insights analysis (in console.redhat.com processing pipeline) for the corresponding Insights data archive. + maxLength: 256 type: string x-kubernetes-validations: - message: insightsRequestID is immutable once set @@ -363,29 +453,55 @@ spec: description: |- group is the API Group of the Resource. Enter empty string for the core group. - This value should consist of only lowercase alphanumeric characters, hyphens and periods. + This value is empty or should follow the DNS1123 subdomain format and it must be at most 253 characters in length. Example: "", "apps", "build.openshift.io", etc. - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + maxLength: 253 type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist of lower + case alphanumeric characters, '-' or '.', and must start + and end with an alphanumeric character. + rule: self.size() == 0 || !format.dns1123Subdomain().validate(self).hasValue() name: - description: name of the referent. + description: |- + name of the referent that follows the DNS1123 subdomain format. + It must be at most 256 characters in length. + maxLength: 256 type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist of lower + case alphanumeric characters, '-' or '.', and must start + and end with an alphanumeric character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' namespace: - description: namespace of the referent. + description: |- + namespace of the referent that follows the DNS1123 subdomain format. + It must be at most 253 characters in length. + maxLength: 253 type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist of lower + case alphanumeric characters, '-' or '.', and must start + and end with an alphanumeric character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' resource: description: |- - resource is the type that is being referenced. + resource is required field of the type that is being referenced. It is normally the plural form of the resource kind in lowercase. This value should consist of only lowercase alphanumeric characters and hyphens. Example: "deployments", "deploymentconfigs", "pods", etc. - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + maxLength: 512 type: string + x-kubernetes-validations: + - message: resource must consist of only lowercase alphanumeric + characters and hyphens + rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$") required: - group - name - resource type: object + maxItems: 100 type: array startTime: description: startTime is the time when Insights data gathering started. diff --git a/insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-DevPreviewNoUpgrade.crd.yaml b/insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-DevPreviewNoUpgrade.crd.yaml index a69db91dd8b..9bac3177041 100644 --- a/insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-DevPreviewNoUpgrade.crd.yaml +++ b/insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-DevPreviewNoUpgrade.crd.yaml @@ -73,7 +73,8 @@ spec: type: string gatherers: description: |- - gatherers is a list of gatherers configurations. + gatherers is an optional list of gatherers configurations. + The list must not exceed 100 items. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'" @@ -81,8 +82,21 @@ spec: description: gathererConfig allows to configure specific gatherers properties: name: - description: name is the name of specific gatherer + description: |- + name is the required name of specific gatherer + It must be at most 256 characters in length. + The format for the gatherer name should be: {gatherer}/{function} where the function is optional. + Gatherer consists of a lowercase letters only that may include underscores (_). + Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). + The particular gatherers can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. + maxLength: 256 type: string + x-kubernetes-validations: + - message: gatherer name must be in the format of {gatherer}/{function} + where the gatherer and function are lowercase letters only + that may include underscores (_) and are separated by a + forward slash (/) if the function is provided + rule: self.matches("^[a-z]+[_a-z]*[a-z]([/a-z][_a-z]*)?[a-z]$") state: description: |- state allows you to configure specific gatherer. Valid values are "Enabled", "Disabled" and omitted. @@ -96,7 +110,70 @@ spec: required: - name type: object + maxItems: 100 type: array + storage: + description: |- + storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. + If omitted, the gathering job will use ephemeral storage. + properties: + persistentVolume: + description: |- + persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. + The PersistentVolume must be created in the openshift-insights namespace. + properties: + claim: + description: |- + claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. + The PersistentVolumeClaim must be created in the openshift-insights namespace. + properties: + name: + description: |- + name is a string that follows the DNS1123 subdomain format. + It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character. + maxLength: 253 + type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist + of lower case alphanumeric characters, '-' or '.', + and must start and end with an alphanumeric character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' + required: + - name + type: object + mountPath: + description: |- + mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. + When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. + The current default mount path is /var/lib/insights-operator + The path may not exceed 1024 characters and must not contain a colon. + maxLength: 1024 + type: string + x-kubernetes-validations: + - message: mountPath must not contain a colon + rule: '!self.contains('':'')' + required: + - claim + type: object + type: + description: |- + type is a required field that specifies the type of storage that will be used to store the Insights data archive. + Valid values are "PersistentVolume" and "Ephemeral". + When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. + When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is + defined by the PersistentVolume field. + enum: + - PersistentVolume + - Ephemeral + type: string + required: + - type + type: object + x-kubernetes-validations: + - message: persistentVolume is required when type is PersistentVolume, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''PersistentVolume'' ? has(self.persistentVolume) + : !has(self.persistentVolume)' type: object status: description: status holds observed values from the cluster. They may not @@ -159,6 +236,7 @@ spec: - status - type type: object + maxItems: 100 type: array x-kubernetes-list-map-keys: - type @@ -256,6 +334,7 @@ spec: - status - type type: object + maxItems: 100 minItems: 1 type: array x-kubernetes-list-map-keys: @@ -275,6 +354,7 @@ spec: - lastGatherDuration - name type: object + maxItems: 100 type: array x-kubernetes-list-map-keys: - name @@ -301,10 +381,14 @@ spec: attributes. properties: advisorURI: - description: advisorURI provides the URL link to the Insights - Advisor. - pattern: ^https:\/\/\S+ + description: |- + advisorURI is required field that provides the URL link to the Insights Advisor. + The link must be a valid HTTPS URL and the maximum length is 2048 characters. + maxLength: 2048 type: string + x-kubernetes-validations: + - message: advisorURI must be a valid HTTPS URL (e.g., https://example.com) + rule: isURL(self) && url(self).getScheme() == "https" description: description: description provides basic description of the healtcheck. @@ -335,18 +419,24 @@ spec: - state - totalRisk type: object + maxItems: 100 type: array x-kubernetes-list-type: atomic uri: - description: uri provides the URL link from which the report was - downloaded. - pattern: ^https:\/\/\S+ + description: |- + uri is optional field that provides the URL link from which the report was downloaded. + The link must be a valid HTTPS URL and the maximum length is 2048 characters. + maxLength: 2048 type: string + x-kubernetes-validations: + - message: URI must be a valid HTTPS URL (e.g., https://example.com) + rule: isURL(self) && url(self).getScheme() == "https" type: object insightsRequestID: description: |- insightsRequestID is an Insights request ID to track the status of the Insights analysis (in console.redhat.com processing pipeline) for the corresponding Insights data archive. + maxLength: 256 type: string x-kubernetes-validations: - message: insightsRequestID is immutable once set @@ -363,29 +453,55 @@ spec: description: |- group is the API Group of the Resource. Enter empty string for the core group. - This value should consist of only lowercase alphanumeric characters, hyphens and periods. + This value is empty or should follow the DNS1123 subdomain format and it must be at most 253 characters in length. Example: "", "apps", "build.openshift.io", etc. - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + maxLength: 253 type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist of lower + case alphanumeric characters, '-' or '.', and must start + and end with an alphanumeric character. + rule: self.size() == 0 || !format.dns1123Subdomain().validate(self).hasValue() name: - description: name of the referent. + description: |- + name of the referent that follows the DNS1123 subdomain format. + It must be at most 256 characters in length. + maxLength: 256 type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist of lower + case alphanumeric characters, '-' or '.', and must start + and end with an alphanumeric character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' namespace: - description: namespace of the referent. + description: |- + namespace of the referent that follows the DNS1123 subdomain format. + It must be at most 253 characters in length. + maxLength: 253 type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist of lower + case alphanumeric characters, '-' or '.', and must start + and end with an alphanumeric character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' resource: description: |- - resource is the type that is being referenced. + resource is required field of the type that is being referenced. It is normally the plural form of the resource kind in lowercase. This value should consist of only lowercase alphanumeric characters and hyphens. Example: "deployments", "deploymentconfigs", "pods", etc. - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + maxLength: 512 type: string + x-kubernetes-validations: + - message: resource must consist of only lowercase alphanumeric + characters and hyphens + rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$") required: - group - name - resource type: object + maxItems: 100 type: array startTime: description: startTime is the time when Insights data gathering started. diff --git a/insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-TechPreviewNoUpgrade.crd.yaml b/insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-TechPreviewNoUpgrade.crd.yaml index 9ff4ef054b2..3dbb6609cab 100644 --- a/insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-TechPreviewNoUpgrade.crd.yaml +++ b/insights/v1alpha1/zz_generated.crd-manifests/0000_10_insights_01_datagathers-TechPreviewNoUpgrade.crd.yaml @@ -73,7 +73,8 @@ spec: type: string gatherers: description: |- - gatherers is a list of gatherers configurations. + gatherers is an optional list of gatherers configurations. + The list must not exceed 100 items. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'" @@ -81,8 +82,21 @@ spec: description: gathererConfig allows to configure specific gatherers properties: name: - description: name is the name of specific gatherer + description: |- + name is the required name of specific gatherer + It must be at most 256 characters in length. + The format for the gatherer name should be: {gatherer}/{function} where the function is optional. + Gatherer consists of a lowercase letters only that may include underscores (_). + Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). + The particular gatherers can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. + maxLength: 256 type: string + x-kubernetes-validations: + - message: gatherer name must be in the format of {gatherer}/{function} + where the gatherer and function are lowercase letters only + that may include underscores (_) and are separated by a + forward slash (/) if the function is provided + rule: self.matches("^[a-z]+[_a-z]*[a-z]([/a-z][_a-z]*)?[a-z]$") state: description: |- state allows you to configure specific gatherer. Valid values are "Enabled", "Disabled" and omitted. @@ -96,7 +110,70 @@ spec: required: - name type: object + maxItems: 100 type: array + storage: + description: |- + storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. + If omitted, the gathering job will use ephemeral storage. + properties: + persistentVolume: + description: |- + persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. + The PersistentVolume must be created in the openshift-insights namespace. + properties: + claim: + description: |- + claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. + The PersistentVolumeClaim must be created in the openshift-insights namespace. + properties: + name: + description: |- + name is a string that follows the DNS1123 subdomain format. + It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character. + maxLength: 253 + type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist + of lower case alphanumeric characters, '-' or '.', + and must start and end with an alphanumeric character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' + required: + - name + type: object + mountPath: + description: |- + mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. + When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. + The current default mount path is /var/lib/insights-operator + The path may not exceed 1024 characters and must not contain a colon. + maxLength: 1024 + type: string + x-kubernetes-validations: + - message: mountPath must not contain a colon + rule: '!self.contains('':'')' + required: + - claim + type: object + type: + description: |- + type is a required field that specifies the type of storage that will be used to store the Insights data archive. + Valid values are "PersistentVolume" and "Ephemeral". + When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. + When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is + defined by the PersistentVolume field. + enum: + - PersistentVolume + - Ephemeral + type: string + required: + - type + type: object + x-kubernetes-validations: + - message: persistentVolume is required when type is PersistentVolume, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''PersistentVolume'' ? has(self.persistentVolume) + : !has(self.persistentVolume)' type: object status: description: status holds observed values from the cluster. They may not @@ -159,6 +236,7 @@ spec: - status - type type: object + maxItems: 100 type: array x-kubernetes-list-map-keys: - type @@ -256,6 +334,7 @@ spec: - status - type type: object + maxItems: 100 minItems: 1 type: array x-kubernetes-list-map-keys: @@ -275,6 +354,7 @@ spec: - lastGatherDuration - name type: object + maxItems: 100 type: array x-kubernetes-list-map-keys: - name @@ -301,10 +381,14 @@ spec: attributes. properties: advisorURI: - description: advisorURI provides the URL link to the Insights - Advisor. - pattern: ^https:\/\/\S+ + description: |- + advisorURI is required field that provides the URL link to the Insights Advisor. + The link must be a valid HTTPS URL and the maximum length is 2048 characters. + maxLength: 2048 type: string + x-kubernetes-validations: + - message: advisorURI must be a valid HTTPS URL (e.g., https://example.com) + rule: isURL(self) && url(self).getScheme() == "https" description: description: description provides basic description of the healtcheck. @@ -335,18 +419,24 @@ spec: - state - totalRisk type: object + maxItems: 100 type: array x-kubernetes-list-type: atomic uri: - description: uri provides the URL link from which the report was - downloaded. - pattern: ^https:\/\/\S+ + description: |- + uri is optional field that provides the URL link from which the report was downloaded. + The link must be a valid HTTPS URL and the maximum length is 2048 characters. + maxLength: 2048 type: string + x-kubernetes-validations: + - message: URI must be a valid HTTPS URL (e.g., https://example.com) + rule: isURL(self) && url(self).getScheme() == "https" type: object insightsRequestID: description: |- insightsRequestID is an Insights request ID to track the status of the Insights analysis (in console.redhat.com processing pipeline) for the corresponding Insights data archive. + maxLength: 256 type: string x-kubernetes-validations: - message: insightsRequestID is immutable once set @@ -363,29 +453,55 @@ spec: description: |- group is the API Group of the Resource. Enter empty string for the core group. - This value should consist of only lowercase alphanumeric characters, hyphens and periods. + This value is empty or should follow the DNS1123 subdomain format and it must be at most 253 characters in length. Example: "", "apps", "build.openshift.io", etc. - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + maxLength: 253 type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist of lower + case alphanumeric characters, '-' or '.', and must start + and end with an alphanumeric character. + rule: self.size() == 0 || !format.dns1123Subdomain().validate(self).hasValue() name: - description: name of the referent. + description: |- + name of the referent that follows the DNS1123 subdomain format. + It must be at most 256 characters in length. + maxLength: 256 type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist of lower + case alphanumeric characters, '-' or '.', and must start + and end with an alphanumeric character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' namespace: - description: namespace of the referent. + description: |- + namespace of the referent that follows the DNS1123 subdomain format. + It must be at most 253 characters in length. + maxLength: 253 type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist of lower + case alphanumeric characters, '-' or '.', and must start + and end with an alphanumeric character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' resource: description: |- - resource is the type that is being referenced. + resource is required field of the type that is being referenced. It is normally the plural form of the resource kind in lowercase. This value should consist of only lowercase alphanumeric characters and hyphens. Example: "deployments", "deploymentconfigs", "pods", etc. - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + maxLength: 512 type: string + x-kubernetes-validations: + - message: resource must consist of only lowercase alphanumeric + characters and hyphens + rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$") required: - group - name - resource type: object + maxItems: 100 type: array startTime: description: startTime is the time when Insights data gathering started. diff --git a/insights/v1alpha1/zz_generated.deepcopy.go b/insights/v1alpha1/zz_generated.deepcopy.go index 1025eb12fc7..b2162fc296a 100644 --- a/insights/v1alpha1/zz_generated.deepcopy.go +++ b/insights/v1alpha1/zz_generated.deepcopy.go @@ -79,6 +79,11 @@ func (in *DataGatherSpec) DeepCopyInto(out *DataGatherSpec) { *out = make([]GathererConfig, len(*in)) copy(*out, *in) } + if in.Storage != nil { + in, out := &in.Storage, &out.Storage + *out = new(Storage) + (*in).DeepCopyInto(*out) + } return } @@ -223,3 +228,57 @@ func (in *ObjectReference) DeepCopy() *ObjectReference { in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PersistentVolumeClaimReference) DeepCopyInto(out *PersistentVolumeClaimReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersistentVolumeClaimReference. +func (in *PersistentVolumeClaimReference) DeepCopy() *PersistentVolumeClaimReference { + if in == nil { + return nil + } + out := new(PersistentVolumeClaimReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PersistentVolumeConfig) DeepCopyInto(out *PersistentVolumeConfig) { + *out = *in + out.Claim = in.Claim + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PersistentVolumeConfig. +func (in *PersistentVolumeConfig) DeepCopy() *PersistentVolumeConfig { + if in == nil { + return nil + } + out := new(PersistentVolumeConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Storage) DeepCopyInto(out *Storage) { + *out = *in + if in.PersistentVolume != nil { + in, out := &in.PersistentVolume, &out.PersistentVolume + *out = new(PersistentVolumeConfig) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Storage. +func (in *Storage) DeepCopy() *Storage { + if in == nil { + return nil + } + out := new(Storage) + in.DeepCopyInto(out) + return out +} diff --git a/insights/v1alpha1/zz_generated.featuregated-crd-manifests/datagathers.insights.openshift.io/InsightsOnDemandDataGather.yaml b/insights/v1alpha1/zz_generated.featuregated-crd-manifests/datagathers.insights.openshift.io/InsightsOnDemandDataGather.yaml index c8335b7b164..4868cb0436d 100644 --- a/insights/v1alpha1/zz_generated.featuregated-crd-manifests/datagathers.insights.openshift.io/InsightsOnDemandDataGather.yaml +++ b/insights/v1alpha1/zz_generated.featuregated-crd-manifests/datagathers.insights.openshift.io/InsightsOnDemandDataGather.yaml @@ -73,7 +73,8 @@ spec: type: string gatherers: description: |- - gatherers is a list of gatherers configurations. + gatherers is an optional list of gatherers configurations. + The list must not exceed 100 items. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: "oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'" @@ -81,8 +82,21 @@ spec: description: gathererConfig allows to configure specific gatherers properties: name: - description: name is the name of specific gatherer + description: |- + name is the required name of specific gatherer + It must be at most 256 characters in length. + The format for the gatherer name should be: {gatherer}/{function} where the function is optional. + Gatherer consists of a lowercase letters only that may include underscores (_). + Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). + The particular gatherers can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. + maxLength: 256 type: string + x-kubernetes-validations: + - message: gatherer name must be in the format of {gatherer}/{function} + where the gatherer and function are lowercase letters only + that may include underscores (_) and are separated by a + forward slash (/) if the function is provided + rule: self.matches("^[a-z]+[_a-z]*[a-z]([/a-z][_a-z]*)?[a-z]$") state: description: |- state allows you to configure specific gatherer. Valid values are "Enabled", "Disabled" and omitted. @@ -96,7 +110,70 @@ spec: required: - name type: object + maxItems: 100 type: array + storage: + description: |- + storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. + If omitted, the gathering job will use ephemeral storage. + properties: + persistentVolume: + description: |- + persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. + The PersistentVolume must be created in the openshift-insights namespace. + properties: + claim: + description: |- + claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. + The PersistentVolumeClaim must be created in the openshift-insights namespace. + properties: + name: + description: |- + name is a string that follows the DNS1123 subdomain format. + It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character. + maxLength: 253 + type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist + of lower case alphanumeric characters, '-' or '.', + and must start and end with an alphanumeric character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' + required: + - name + type: object + mountPath: + description: |- + mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. + When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. + The current default mount path is /var/lib/insights-operator + The path may not exceed 1024 characters and must not contain a colon. + maxLength: 1024 + type: string + x-kubernetes-validations: + - message: mountPath must not contain a colon + rule: '!self.contains('':'')' + required: + - claim + type: object + type: + description: |- + type is a required field that specifies the type of storage that will be used to store the Insights data archive. + Valid values are "PersistentVolume" and "Ephemeral". + When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. + When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is + defined by the PersistentVolume field. + enum: + - PersistentVolume + - Ephemeral + type: string + required: + - type + type: object + x-kubernetes-validations: + - message: persistentVolume is required when type is PersistentVolume, + and forbidden otherwise + rule: 'has(self.type) && self.type == ''PersistentVolume'' ? has(self.persistentVolume) + : !has(self.persistentVolume)' type: object status: description: status holds observed values from the cluster. They may not @@ -159,6 +236,7 @@ spec: - status - type type: object + maxItems: 100 type: array x-kubernetes-list-map-keys: - type @@ -256,6 +334,7 @@ spec: - status - type type: object + maxItems: 100 minItems: 1 type: array x-kubernetes-list-map-keys: @@ -275,6 +354,7 @@ spec: - lastGatherDuration - name type: object + maxItems: 100 type: array x-kubernetes-list-map-keys: - name @@ -301,10 +381,14 @@ spec: attributes. properties: advisorURI: - description: advisorURI provides the URL link to the Insights - Advisor. - pattern: ^https:\/\/\S+ + description: |- + advisorURI is required field that provides the URL link to the Insights Advisor. + The link must be a valid HTTPS URL and the maximum length is 2048 characters. + maxLength: 2048 type: string + x-kubernetes-validations: + - message: advisorURI must be a valid HTTPS URL (e.g., https://example.com) + rule: isURL(self) && url(self).getScheme() == "https" description: description: description provides basic description of the healtcheck. @@ -335,18 +419,24 @@ spec: - state - totalRisk type: object + maxItems: 100 type: array x-kubernetes-list-type: atomic uri: - description: uri provides the URL link from which the report was - downloaded. - pattern: ^https:\/\/\S+ + description: |- + uri is optional field that provides the URL link from which the report was downloaded. + The link must be a valid HTTPS URL and the maximum length is 2048 characters. + maxLength: 2048 type: string + x-kubernetes-validations: + - message: URI must be a valid HTTPS URL (e.g., https://example.com) + rule: isURL(self) && url(self).getScheme() == "https" type: object insightsRequestID: description: |- insightsRequestID is an Insights request ID to track the status of the Insights analysis (in console.redhat.com processing pipeline) for the corresponding Insights data archive. + maxLength: 256 type: string x-kubernetes-validations: - message: insightsRequestID is immutable once set @@ -363,29 +453,55 @@ spec: description: |- group is the API Group of the Resource. Enter empty string for the core group. - This value should consist of only lowercase alphanumeric characters, hyphens and periods. + This value is empty or should follow the DNS1123 subdomain format and it must be at most 253 characters in length. Example: "", "apps", "build.openshift.io", etc. - pattern: ^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ + maxLength: 253 type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist of lower + case alphanumeric characters, '-' or '.', and must start + and end with an alphanumeric character. + rule: self.size() == 0 || !format.dns1123Subdomain().validate(self).hasValue() name: - description: name of the referent. + description: |- + name of the referent that follows the DNS1123 subdomain format. + It must be at most 256 characters in length. + maxLength: 256 type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist of lower + case alphanumeric characters, '-' or '.', and must start + and end with an alphanumeric character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' namespace: - description: namespace of the referent. + description: |- + namespace of the referent that follows the DNS1123 subdomain format. + It must be at most 253 characters in length. + maxLength: 253 type: string + x-kubernetes-validations: + - message: a lowercase RFC 1123 subdomain must consist of lower + case alphanumeric characters, '-' or '.', and must start + and end with an alphanumeric character. + rule: '!format.dns1123Subdomain().validate(self).hasValue()' resource: description: |- - resource is the type that is being referenced. + resource is required field of the type that is being referenced. It is normally the plural form of the resource kind in lowercase. This value should consist of only lowercase alphanumeric characters and hyphens. Example: "deployments", "deploymentconfigs", "pods", etc. - pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ + maxLength: 512 type: string + x-kubernetes-validations: + - message: resource must consist of only lowercase alphanumeric + characters and hyphens + rule: self.matches("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$") required: - group - name - resource type: object + maxItems: 100 type: array startTime: description: startTime is the time when Insights data gathering started. diff --git a/insights/v1alpha1/zz_generated.swagger_doc_generated.go b/insights/v1alpha1/zz_generated.swagger_doc_generated.go index fe8a827f460..45f77b10702 100644 --- a/insights/v1alpha1/zz_generated.swagger_doc_generated.go +++ b/insights/v1alpha1/zz_generated.swagger_doc_generated.go @@ -35,7 +35,8 @@ func (DataGatherList) SwaggerDoc() map[string]string { var map_DataGatherSpec = map[string]string{ "": "DataGatherSpec contains the configuration for the DataGather.", "dataPolicy": "dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain in the Insights archive data. Valid values are \"ClearText\" and \"ObfuscateNetworking\". When set to ClearText the data is not obfuscated. When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The current default is ClearText.", - "gatherers": "gatherers is a list of gatherers configurations. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: \"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'\"", + "gatherers": "gatherers is an optional list of gatherers configurations. The list must not exceed 100 items. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: \"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'\"", + "storage": "storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. If omitted, the gathering job will use ephemeral storage.", } func (DataGatherSpec) SwaggerDoc() map[string]string { @@ -60,7 +61,7 @@ func (DataGatherStatus) SwaggerDoc() map[string]string { var map_GathererConfig = map[string]string{ "": "gathererConfig allows to configure specific gatherers", - "name": "name is the name of specific gatherer", + "name": "name is the required name of specific gatherer It must be at most 256 characters in length. The format for the gatherer name should be: {gatherer}/{function} where the function is optional. Gatherer consists of a lowercase letters only that may include underscores (_). Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). The particular gatherers can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md.", "state": "state allows you to configure specific gatherer. Valid values are \"Enabled\", \"Disabled\" and omitted. When omitted, this means no opinion and the platform is left to choose a reasonable default. The current default is Enabled.", } @@ -83,7 +84,7 @@ var map_HealthCheck = map[string]string{ "": "healthCheck represents an Insights health check attributes.", "description": "description provides basic description of the healtcheck.", "totalRisk": "totalRisk of the healthcheck. Indicator of the total risk posed by the detected issue; combination of impact and likelihood. The values can be from 1 to 4, and the higher the number, the more important the issue.", - "advisorURI": "advisorURI provides the URL link to the Insights Advisor.", + "advisorURI": "advisorURI is required field that provides the URL link to the Insights Advisor. The link must be a valid HTTPS URL and the maximum length is 2048 characters.", "state": "state determines what the current state of the health check is. Health check is enabled by default and can be disabled by the user in the Insights advisor user interface.", } @@ -95,7 +96,7 @@ var map_InsightsReport = map[string]string{ "": "insightsReport provides Insights health check report based on the most recently sent Insights data.", "downloadedAt": "downloadedAt is the time when the last Insights report was downloaded. An empty value means that there has not been any Insights report downloaded yet and it usually appears in disconnected clusters (or clusters when the Insights data gathering is disabled).", "healthChecks": "healthChecks provides basic information about active Insights health checks in a cluster.", - "uri": "uri provides the URL link from which the report was downloaded.", + "uri": "uri is optional field that provides the URL link from which the report was downloaded. The link must be a valid HTTPS URL and the maximum length is 2048 characters.", } func (InsightsReport) SwaggerDoc() map[string]string { @@ -104,14 +105,43 @@ func (InsightsReport) SwaggerDoc() map[string]string { var map_ObjectReference = map[string]string{ "": "ObjectReference contains enough information to let you inspect or modify the referred object.", - "group": "group is the API Group of the Resource. Enter empty string for the core group. This value should consist of only lowercase alphanumeric characters, hyphens and periods. Example: \"\", \"apps\", \"build.openshift.io\", etc.", - "resource": "resource is the type that is being referenced. It is normally the plural form of the resource kind in lowercase. This value should consist of only lowercase alphanumeric characters and hyphens. Example: \"deployments\", \"deploymentconfigs\", \"pods\", etc.", - "name": "name of the referent.", - "namespace": "namespace of the referent.", + "group": "group is the API Group of the Resource. Enter empty string for the core group. This value is empty or should follow the DNS1123 subdomain format and it must be at most 253 characters in length. Example: \"\", \"apps\", \"build.openshift.io\", etc.", + "resource": "resource is required field of the type that is being referenced. It is normally the plural form of the resource kind in lowercase. This value should consist of only lowercase alphanumeric characters and hyphens. Example: \"deployments\", \"deploymentconfigs\", \"pods\", etc.", + "name": "name of the referent that follows the DNS1123 subdomain format. It must be at most 256 characters in length.", + "namespace": "namespace of the referent that follows the DNS1123 subdomain format. It must be at most 253 characters in length.", } func (ObjectReference) SwaggerDoc() map[string]string { return map_ObjectReference } +var map_PersistentVolumeClaimReference = map[string]string{ + "": "persistentVolumeClaimReference is a reference to a PersistentVolumeClaim.", + "name": "name is a string that follows the DNS1123 subdomain format. It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character.", +} + +func (PersistentVolumeClaimReference) SwaggerDoc() map[string]string { + return map_PersistentVolumeClaimReference +} + +var map_PersistentVolumeConfig = map[string]string{ + "": "persistentVolumeConfig provides configuration options for PersistentVolume storage.", + "claim": "claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. The PersistentVolumeClaim must be created in the openshift-insights namespace.", + "mountPath": "mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The current default mount path is /var/lib/insights-operator The path may not exceed 1024 characters and must not contain a colon.", +} + +func (PersistentVolumeConfig) SwaggerDoc() map[string]string { + return map_PersistentVolumeConfig +} + +var map_Storage = map[string]string{ + "": "storage provides persistent storage configuration options for gathering jobs. If the type is set to PersistentVolume, then the PersistentVolume must be defined. If the type is set to Ephemeral, then the PersistentVolume must not be defined.", + "type": "type is a required field that specifies the type of storage that will be used to store the Insights data archive. Valid values are \"PersistentVolume\" and \"Ephemeral\". When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the PersistentVolume field.", + "persistentVolume": "persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. The PersistentVolume must be created in the openshift-insights namespace.", +} + +func (Storage) SwaggerDoc() map[string]string { + return map_Storage +} + // AUTO-GENERATED FUNCTIONS END HERE diff --git a/openapi/generated_openapi/zz_generated.openapi.go b/openapi/generated_openapi/zz_generated.openapi.go index 6d40b8b3b7e..72cc0a0b5ce 100644 --- a/openapi/generated_openapi/zz_generated.openapi.go +++ b/openapi/generated_openapi/zz_generated.openapi.go @@ -425,6 +425,8 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/openshift/api/config/v1alpha1.InsightsDataGatherStatus": schema_openshift_api_config_v1alpha1_InsightsDataGatherStatus(ref), "github.com/openshift/api/config/v1alpha1.PKI": schema_openshift_api_config_v1alpha1_PKI(ref), "github.com/openshift/api/config/v1alpha1.PKICertificateSubject": schema_openshift_api_config_v1alpha1_PKICertificateSubject(ref), + "github.com/openshift/api/config/v1alpha1.PersistentVolumeClaimReference": schema_openshift_api_config_v1alpha1_PersistentVolumeClaimReference(ref), + "github.com/openshift/api/config/v1alpha1.PersistentVolumeConfig": schema_openshift_api_config_v1alpha1_PersistentVolumeConfig(ref), "github.com/openshift/api/config/v1alpha1.Policy": schema_openshift_api_config_v1alpha1_Policy(ref), "github.com/openshift/api/config/v1alpha1.PolicyFulcioSubject": schema_openshift_api_config_v1alpha1_PolicyFulcioSubject(ref), "github.com/openshift/api/config/v1alpha1.PolicyIdentity": schema_openshift_api_config_v1alpha1_PolicyIdentity(ref), @@ -435,6 +437,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/openshift/api/config/v1alpha1.RetentionNumberConfig": schema_openshift_api_config_v1alpha1_RetentionNumberConfig(ref), "github.com/openshift/api/config/v1alpha1.RetentionPolicy": schema_openshift_api_config_v1alpha1_RetentionPolicy(ref), "github.com/openshift/api/config/v1alpha1.RetentionSizeConfig": schema_openshift_api_config_v1alpha1_RetentionSizeConfig(ref), + "github.com/openshift/api/config/v1alpha1.Storage": schema_openshift_api_config_v1alpha1_Storage(ref), "github.com/openshift/api/config/v1alpha1.UserDefinedMonitoring": schema_openshift_api_config_v1alpha1_UserDefinedMonitoring(ref), "github.com/openshift/api/console/v1.ApplicationMenuSpec": schema_openshift_api_console_v1_ApplicationMenuSpec(ref), "github.com/openshift/api/console/v1.CLIDownloadLink": schema_openshift_api_console_v1_CLIDownloadLink(ref), @@ -546,6 +549,9 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/openshift/api/insights/v1alpha1.HealthCheck": schema_openshift_api_insights_v1alpha1_HealthCheck(ref), "github.com/openshift/api/insights/v1alpha1.InsightsReport": schema_openshift_api_insights_v1alpha1_InsightsReport(ref), "github.com/openshift/api/insights/v1alpha1.ObjectReference": schema_openshift_api_insights_v1alpha1_ObjectReference(ref), + "github.com/openshift/api/insights/v1alpha1.PersistentVolumeClaimReference": schema_openshift_api_insights_v1alpha1_PersistentVolumeClaimReference(ref), + "github.com/openshift/api/insights/v1alpha1.PersistentVolumeConfig": schema_openshift_api_insights_v1alpha1_PersistentVolumeConfig(ref), + "github.com/openshift/api/insights/v1alpha1.Storage": schema_openshift_api_insights_v1alpha1_Storage(ref), "github.com/openshift/api/kubecontrolplane/v1.AggregatorConfig": schema_openshift_api_kubecontrolplane_v1_AggregatorConfig(ref), "github.com/openshift/api/kubecontrolplane/v1.KubeAPIServerConfig": schema_openshift_api_kubecontrolplane_v1_KubeAPIServerConfig(ref), "github.com/openshift/api/kubecontrolplane/v1.KubeAPIServerImagePolicyConfig": schema_openshift_api_kubecontrolplane_v1_KubeAPIServerImagePolicyConfig(ref), @@ -20734,14 +20740,14 @@ func schema_openshift_api_config_v1alpha1_GatherConfig(ref common.ReferenceCallb Properties: map[string]spec.Schema{ "dataPolicy": { SchemaProps: spec.SchemaProps{ - Description: "dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain in the Insights archive data. Valid values are \"None\" and \"ObfuscateNetworking\". When set to None the data is not obfuscated. When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The current default is None.", + Description: "dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain in the Insights archive data. Valid values are \"None\" and \"ObfuscateNetworking\". When set to None the data is not obfuscated. When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.", Type: []string{"string"}, Format: "", }, }, "disabledGatherers": { SchemaProps: spec.SchemaProps{ - Description: "disabledGatherers is a list of gatherers to be excluded from the gathering. All the gatherers can be disabled by providing \"all\" value. If all the gatherers are disabled, the Insights operator does not gather any data. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: \"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'\" An example of disabling gatherers looks like this: `disabledGatherers: [\"clusterconfig/machine_configs\", \"workloads/workload_info\"]`", + Description: "disabledGatherers is a list of gatherers to be excluded from the gathering. All the gatherers can be disabled by providing \"all\" value. If all the gatherers are disabled, the Insights operator does not gather any data. The format for the disabledGatherer should be: {gatherer}/{function} where the function is optional. Gatherer consists of a lowercase letters only that may include underscores (_). Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: \"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'\" An example of disabling gatherers looks like this: `disabledGatherers: [\"clusterconfig/machine_configs\", \"workloads/workload_info\"]`", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -20754,9 +20760,17 @@ func schema_openshift_api_config_v1alpha1_GatherConfig(ref common.ReferenceCallb }, }, }, + "storage": { + SchemaProps: spec.SchemaProps{ + Description: "storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. If omitted, the gathering job will use ephemeral storage.", + Ref: ref("github.com/openshift/api/config/v1alpha1.Storage"), + }, + }, }, }, }, + Dependencies: []string{ + "github.com/openshift/api/config/v1alpha1.Storage"}, } } @@ -21136,6 +21150,58 @@ func schema_openshift_api_config_v1alpha1_PKICertificateSubject(ref common.Refer } } +func schema_openshift_api_config_v1alpha1_PersistentVolumeClaimReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "persistentVolumeClaimReference is a reference to a PersistentVolumeClaim.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is a string that follows the DNS1123 subdomain format. It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + } +} + +func schema_openshift_api_config_v1alpha1_PersistentVolumeConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "persistentVolumeConfig provides configuration options for PersistentVolume storage.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "claim": { + SchemaProps: spec.SchemaProps{ + Description: "claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. The PersistentVolumeClaim must be created in the openshift-insights namespace.", + Default: map[string]interface{}{}, + Ref: ref("github.com/openshift/api/config/v1alpha1.PersistentVolumeClaimReference"), + }, + }, + "mountPath": { + SchemaProps: spec.SchemaProps{ + Description: "mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The current default mount path is /var/lib/insights-operator The path may not exceed 1024 characters and must not contain a colon.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"claim"}, + }, + }, + Dependencies: []string{ + "github.com/openshift/api/config/v1alpha1.PersistentVolumeClaimReference"}, + } +} + func schema_openshift_api_config_v1alpha1_Policy(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -21471,6 +21537,36 @@ func schema_openshift_api_config_v1alpha1_RetentionSizeConfig(ref common.Referen } } +func schema_openshift_api_config_v1alpha1_Storage(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "storage provides persistent storage configuration options for gathering jobs. If the type is set to PersistentVolume, then the PersistentVolume must be defined. If the type is set to Ephemeral, then the PersistentVolume must not be defined.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type is a required field that specifies the type of storage that will be used to store the Insights data archive. Valid values are \"PersistentVolume\" and \"Ephemeral\". When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the persistentVolume field.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "persistentVolume": { + SchemaProps: spec.SchemaProps{ + Description: "persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. The PersistentVolume must be created in the openshift-insights namespace.", + Ref: ref("github.com/openshift/api/config/v1alpha1.PersistentVolumeConfig"), + }, + }, + }, + Required: []string{"type"}, + }, + }, + Dependencies: []string{ + "github.com/openshift/api/config/v1alpha1.PersistentVolumeConfig"}, + } +} + func schema_openshift_api_config_v1alpha1_UserDefinedMonitoring(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -26434,6 +26530,11 @@ func schema_openshift_api_insights_v1alpha1_DataGatherList(ref common.ReferenceC }, }, "items": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, SchemaProps: spec.SchemaProps{ Description: "items contains a list of DataGather resources.", Type: []string{"array"}, @@ -26448,7 +26549,6 @@ func schema_openshift_api_insights_v1alpha1_DataGatherList(ref common.ReferenceC }, }, }, - Required: []string{"metadata", "items"}, }, }, Dependencies: []string{ @@ -26473,7 +26573,7 @@ func schema_openshift_api_insights_v1alpha1_DataGatherSpec(ref common.ReferenceC }, "gatherers": { SchemaProps: spec.SchemaProps{ - Description: "gatherers is a list of gatherers configurations. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: \"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'\"", + Description: "gatherers is an optional list of gatherers configurations. The list must not exceed 100 items. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: \"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'\"", Type: []string{"array"}, Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ @@ -26485,11 +26585,17 @@ func schema_openshift_api_insights_v1alpha1_DataGatherSpec(ref common.ReferenceC }, }, }, + "storage": { + SchemaProps: spec.SchemaProps{ + Description: "storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. If omitted, the gathering job will use ephemeral storage.", + Ref: ref("github.com/openshift/api/insights/v1alpha1.Storage"), + }, + }, }, }, }, Dependencies: []string{ - "github.com/openshift/api/insights/v1alpha1.GathererConfig"}, + "github.com/openshift/api/insights/v1alpha1.GathererConfig", "github.com/openshift/api/insights/v1alpha1.Storage"}, } } @@ -26610,7 +26716,7 @@ func schema_openshift_api_insights_v1alpha1_GathererConfig(ref common.ReferenceC Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Description: "name is the name of specific gatherer", + Description: "name is the required name of specific gatherer It must be at most 256 characters in length. The format for the gatherer name should be: {gatherer}/{function} where the function is optional. Gatherer consists of a lowercase letters only that may include underscores (_). Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). The particular gatherers can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md.", Default: "", Type: []string{"string"}, Format: "", @@ -26710,7 +26816,7 @@ func schema_openshift_api_insights_v1alpha1_HealthCheck(ref common.ReferenceCall }, "advisorURI": { SchemaProps: spec.SchemaProps{ - Description: "advisorURI provides the URL link to the Insights Advisor.", + Description: "advisorURI is required field that provides the URL link to the Insights Advisor. The link must be a valid HTTPS URL and the maximum length is 2048 characters.", Default: "", Type: []string{"string"}, Format: "", @@ -26765,7 +26871,7 @@ func schema_openshift_api_insights_v1alpha1_InsightsReport(ref common.ReferenceC }, "uri": { SchemaProps: spec.SchemaProps{ - Description: "uri provides the URL link from which the report was downloaded.", + Description: "uri is optional field that provides the URL link from which the report was downloaded. The link must be a valid HTTPS URL and the maximum length is 2048 characters.", Type: []string{"string"}, Format: "", }, @@ -26787,7 +26893,7 @@ func schema_openshift_api_insights_v1alpha1_ObjectReference(ref common.Reference Properties: map[string]spec.Schema{ "group": { SchemaProps: spec.SchemaProps{ - Description: "group is the API Group of the Resource. Enter empty string for the core group. This value should consist of only lowercase alphanumeric characters, hyphens and periods. Example: \"\", \"apps\", \"build.openshift.io\", etc.", + Description: "group is the API Group of the Resource. Enter empty string for the core group. This value is empty or should follow the DNS1123 subdomain format and it must be at most 253 characters in length. Example: \"\", \"apps\", \"build.openshift.io\", etc.", Default: "", Type: []string{"string"}, Format: "", @@ -26795,7 +26901,7 @@ func schema_openshift_api_insights_v1alpha1_ObjectReference(ref common.Reference }, "resource": { SchemaProps: spec.SchemaProps{ - Description: "resource is the type that is being referenced. It is normally the plural form of the resource kind in lowercase. This value should consist of only lowercase alphanumeric characters and hyphens. Example: \"deployments\", \"deploymentconfigs\", \"pods\", etc.", + Description: "resource is required field of the type that is being referenced. It is normally the plural form of the resource kind in lowercase. This value should consist of only lowercase alphanumeric characters and hyphens. Example: \"deployments\", \"deploymentconfigs\", \"pods\", etc.", Default: "", Type: []string{"string"}, Format: "", @@ -26803,7 +26909,7 @@ func schema_openshift_api_insights_v1alpha1_ObjectReference(ref common.Reference }, "name": { SchemaProps: spec.SchemaProps{ - Description: "name of the referent.", + Description: "name of the referent that follows the DNS1123 subdomain format. It must be at most 256 characters in length.", Default: "", Type: []string{"string"}, Format: "", @@ -26811,7 +26917,7 @@ func schema_openshift_api_insights_v1alpha1_ObjectReference(ref common.Reference }, "namespace": { SchemaProps: spec.SchemaProps{ - Description: "namespace of the referent.", + Description: "namespace of the referent that follows the DNS1123 subdomain format. It must be at most 253 characters in length.", Type: []string{"string"}, Format: "", }, @@ -26823,6 +26929,88 @@ func schema_openshift_api_insights_v1alpha1_ObjectReference(ref common.Reference } } +func schema_openshift_api_insights_v1alpha1_PersistentVolumeClaimReference(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "persistentVolumeClaimReference is a reference to a PersistentVolumeClaim.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Description: "name is a string that follows the DNS1123 subdomain format. It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name"}, + }, + }, + } +} + +func schema_openshift_api_insights_v1alpha1_PersistentVolumeConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "persistentVolumeConfig provides configuration options for PersistentVolume storage.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "claim": { + SchemaProps: spec.SchemaProps{ + Description: "claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. The PersistentVolumeClaim must be created in the openshift-insights namespace.", + Default: map[string]interface{}{}, + Ref: ref("github.com/openshift/api/insights/v1alpha1.PersistentVolumeClaimReference"), + }, + }, + "mountPath": { + SchemaProps: spec.SchemaProps{ + Description: "mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The current default mount path is /var/lib/insights-operator The path may not exceed 1024 characters and must not contain a colon.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"claim"}, + }, + }, + Dependencies: []string{ + "github.com/openshift/api/insights/v1alpha1.PersistentVolumeClaimReference"}, + } +} + +func schema_openshift_api_insights_v1alpha1_Storage(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "storage provides persistent storage configuration options for gathering jobs. If the type is set to PersistentVolume, then the PersistentVolume must be defined. If the type is set to Ephemeral, then the PersistentVolume must not be defined.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "type": { + SchemaProps: spec.SchemaProps{ + Description: "type is a required field that specifies the type of storage that will be used to store the Insights data archive. Valid values are \"PersistentVolume\" and \"Ephemeral\". When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the PersistentVolume field.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "persistentVolume": { + SchemaProps: spec.SchemaProps{ + Description: "persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. The PersistentVolume must be created in the openshift-insights namespace.", + Ref: ref("github.com/openshift/api/insights/v1alpha1.PersistentVolumeConfig"), + }, + }, + }, + Required: []string{"type"}, + }, + }, + Dependencies: []string{ + "github.com/openshift/api/insights/v1alpha1.PersistentVolumeConfig"}, + } +} + func schema_openshift_api_kubecontrolplane_v1_AggregatorConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/openapi/openapi.json b/openapi/openapi.json index fe9cb3b8371..29cb923f359 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -11306,16 +11306,20 @@ "type": "object", "properties": { "dataPolicy": { - "description": "dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain in the Insights archive data. Valid values are \"None\" and \"ObfuscateNetworking\". When set to None the data is not obfuscated. When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The current default is None.", + "description": "dataPolicy allows user to enable additional global obfuscation of the IP addresses and base domain in the Insights archive data. Valid values are \"None\" and \"ObfuscateNetworking\". When set to None the data is not obfuscated. When set to ObfuscateNetworking the IP addresses and the cluster domain name are obfuscated. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time.", "type": "string" }, "disabledGatherers": { - "description": "disabledGatherers is a list of gatherers to be excluded from the gathering. All the gatherers can be disabled by providing \"all\" value. If all the gatherers are disabled, the Insights operator does not gather any data. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: \"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'\" An example of disabling gatherers looks like this: `disabledGatherers: [\"clusterconfig/machine_configs\", \"workloads/workload_info\"]`", + "description": "disabledGatherers is a list of gatherers to be excluded from the gathering. All the gatherers can be disabled by providing \"all\" value. If all the gatherers are disabled, the Insights operator does not gather any data. The format for the disabledGatherer should be: {gatherer}/{function} where the function is optional. Gatherer consists of a lowercase letters only that may include underscores (_). Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: \"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'\" An example of disabling gatherers looks like this: `disabledGatherers: [\"clusterconfig/machine_configs\", \"workloads/workload_info\"]`", "type": "array", "items": { "type": "string", "default": "" } + }, + "storage": { + "description": "storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. If omitted, the gathering job will use ephemeral storage.", + "$ref": "#/definitions/com.github.openshift.api.config.v1alpha1.Storage" } } }, @@ -11536,6 +11540,38 @@ } } }, + "com.github.openshift.api.config.v1alpha1.PersistentVolumeClaimReference": { + "description": "persistentVolumeClaimReference is a reference to a PersistentVolumeClaim.", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "name is a string that follows the DNS1123 subdomain format. It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character.", + "type": "string", + "default": "" + } + } + }, + "com.github.openshift.api.config.v1alpha1.PersistentVolumeConfig": { + "description": "persistentVolumeConfig provides configuration options for PersistentVolume storage.", + "type": "object", + "required": [ + "claim" + ], + "properties": { + "claim": { + "description": "claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. The PersistentVolumeClaim must be created in the openshift-insights namespace.", + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.config.v1alpha1.PersistentVolumeClaimReference" + }, + "mountPath": { + "description": "mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The current default mount path is /var/lib/insights-operator The path may not exceed 1024 characters and must not contain a colon.", + "type": "string" + } + } + }, "com.github.openshift.api.config.v1alpha1.Policy": { "description": "Policy defines the verification policy for the items in the scopes list.", "type": "object", @@ -11756,6 +11792,24 @@ } } }, + "com.github.openshift.api.config.v1alpha1.Storage": { + "description": "storage provides persistent storage configuration options for gathering jobs. If the type is set to PersistentVolume, then the PersistentVolume must be defined. If the type is set to Ephemeral, then the PersistentVolume must not be defined.", + "type": "object", + "required": [ + "type" + ], + "properties": { + "persistentVolume": { + "description": "persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. The PersistentVolume must be created in the openshift-insights namespace.", + "$ref": "#/definitions/com.github.openshift.api.config.v1alpha1.PersistentVolumeConfig" + }, + "type": { + "description": "type is a required field that specifies the type of storage that will be used to store the Insights data archive. Valid values are \"PersistentVolume\" and \"Ephemeral\". When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the persistentVolume field.", + "type": "string", + "default": "" + } + } + }, "com.github.openshift.api.config.v1alpha1.UserDefinedMonitoring": { "description": "UserDefinedMonitoring config for user-defined projects.", "type": "object", @@ -14765,10 +14819,6 @@ "com.github.openshift.api.insights.v1alpha1.DataGatherList": { "description": "DataGatherList is a collection of items\n\nCompatibility level 4: No compatibility is provided, the API can change at any point for any reason. These capabilities should not be used by applications needing long term support.", "type": "object", - "required": [ - "metadata", - "items" - ], "properties": { "apiVersion": { "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", @@ -14780,7 +14830,8 @@ "items": { "default": {}, "$ref": "#/definitions/com.github.openshift.api.insights.v1alpha1.DataGather" - } + }, + "x-kubernetes-list-type": "atomic" }, "kind": { "description": "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", @@ -14803,12 +14854,16 @@ "default": "" }, "gatherers": { - "description": "gatherers is a list of gatherers configurations. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: \"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'\"", + "description": "gatherers is an optional list of gatherers configurations. The list must not exceed 100 items. The particular gatherers IDs can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md. Run the following command to get the names of last active gatherers: \"oc get insightsoperators.operator.openshift.io cluster -o json | jq '.status.gatherStatus.gatherers[].name'\"", "type": "array", "items": { "default": {}, "$ref": "#/definitions/com.github.openshift.api.insights.v1alpha1.GathererConfig" } + }, + "storage": { + "description": "storage is an optional field that allows user to define persistent storage for gathering jobs to store the Insights data archive. If omitted, the gathering job will use ephemeral storage.", + "$ref": "#/definitions/com.github.openshift.api.insights.v1alpha1.Storage" } } }, @@ -14881,7 +14936,7 @@ ], "properties": { "name": { - "description": "name is the name of specific gatherer", + "description": "name is the required name of specific gatherer It must be at most 256 characters in length. The format for the gatherer name should be: {gatherer}/{function} where the function is optional. Gatherer consists of a lowercase letters only that may include underscores (_). Function consists of a lowercase letters only that may include underscores (_) and is separated from the gatherer by a forward slash (/). The particular gatherers can be found at https://github.com/openshift/insights-operator/blob/master/docs/gathered-data.md.", "type": "string", "default": "" }, @@ -14937,7 +14992,7 @@ ], "properties": { "advisorURI": { - "description": "advisorURI provides the URL link to the Insights Advisor.", + "description": "advisorURI is required field that provides the URL link to the Insights Advisor. The link must be a valid HTTPS URL and the maximum length is 2048 characters.", "type": "string", "default": "" }, @@ -14977,7 +15032,7 @@ "x-kubernetes-list-type": "atomic" }, "uri": { - "description": "uri provides the URL link from which the report was downloaded.", + "description": "uri is optional field that provides the URL link from which the report was downloaded. The link must be a valid HTTPS URL and the maximum length is 2048 characters.", "type": "string" } } @@ -14992,21 +15047,71 @@ ], "properties": { "group": { - "description": "group is the API Group of the Resource. Enter empty string for the core group. This value should consist of only lowercase alphanumeric characters, hyphens and periods. Example: \"\", \"apps\", \"build.openshift.io\", etc.", + "description": "group is the API Group of the Resource. Enter empty string for the core group. This value is empty or should follow the DNS1123 subdomain format and it must be at most 253 characters in length. Example: \"\", \"apps\", \"build.openshift.io\", etc.", "type": "string", "default": "" }, "name": { - "description": "name of the referent.", + "description": "name of the referent that follows the DNS1123 subdomain format. It must be at most 256 characters in length.", "type": "string", "default": "" }, "namespace": { - "description": "namespace of the referent.", + "description": "namespace of the referent that follows the DNS1123 subdomain format. It must be at most 253 characters in length.", "type": "string" }, "resource": { - "description": "resource is the type that is being referenced. It is normally the plural form of the resource kind in lowercase. This value should consist of only lowercase alphanumeric characters and hyphens. Example: \"deployments\", \"deploymentconfigs\", \"pods\", etc.", + "description": "resource is required field of the type that is being referenced. It is normally the plural form of the resource kind in lowercase. This value should consist of only lowercase alphanumeric characters and hyphens. Example: \"deployments\", \"deploymentconfigs\", \"pods\", etc.", + "type": "string", + "default": "" + } + } + }, + "com.github.openshift.api.insights.v1alpha1.PersistentVolumeClaimReference": { + "description": "persistentVolumeClaimReference is a reference to a PersistentVolumeClaim.", + "type": "object", + "required": [ + "name" + ], + "properties": { + "name": { + "description": "name is a string that follows the DNS1123 subdomain format. It must be at most 253 characters in length, and must consist only of lower case alphanumeric characters, '-' and '.', and must start and end with an alphanumeric character.", + "type": "string", + "default": "" + } + } + }, + "com.github.openshift.api.insights.v1alpha1.PersistentVolumeConfig": { + "description": "persistentVolumeConfig provides configuration options for PersistentVolume storage.", + "type": "object", + "required": [ + "claim" + ], + "properties": { + "claim": { + "description": "claim is a required field that specifies the configuration of the PersistentVolumeClaim that will be used to store the Insights data archive. The PersistentVolumeClaim must be created in the openshift-insights namespace.", + "default": {}, + "$ref": "#/definitions/com.github.openshift.api.insights.v1alpha1.PersistentVolumeClaimReference" + }, + "mountPath": { + "description": "mountPath is an optional field specifying the directory where the PVC will be mounted inside the Insights data gathering Pod. When omitted, this means no opinion and the platform is left to choose a reasonable default, which is subject to change over time. The current default mount path is /var/lib/insights-operator The path may not exceed 1024 characters and must not contain a colon.", + "type": "string" + } + } + }, + "com.github.openshift.api.insights.v1alpha1.Storage": { + "description": "storage provides persistent storage configuration options for gathering jobs. If the type is set to PersistentVolume, then the PersistentVolume must be defined. If the type is set to Ephemeral, then the PersistentVolume must not be defined.", + "type": "object", + "required": [ + "type" + ], + "properties": { + "persistentVolume": { + "description": "persistentVolume is an optional field that specifies the PersistentVolume that will be used to store the Insights data archive. The PersistentVolume must be created in the openshift-insights namespace.", + "$ref": "#/definitions/com.github.openshift.api.insights.v1alpha1.PersistentVolumeConfig" + }, + "type": { + "description": "type is a required field that specifies the type of storage that will be used to store the Insights data archive. Valid values are \"PersistentVolume\" and \"Ephemeral\". When set to Ephemeral, the Insights data archive is stored in the ephemeral storage of the gathering job. When set to PersistentVolume, the Insights data archive is stored in the PersistentVolume that is defined by the PersistentVolume field.", "type": "string", "default": "" }