diff --git a/resource_customizations/core.humio.com/HumioAction/health.lua b/resource_customizations/core.humio.com/HumioAction/health.lua new file mode 100644 index 0000000000000..a99a0eb2e0d59 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAction/health.lua @@ -0,0 +1,30 @@ +hs = { + status = "Progressing", + message = "Update in progress" +} +if obj.status ~= nil then + if obj.status.state ~= nil then + if obj.status.state == "Exists" then + hs.status = "Healthy" + hs.message = "Component state: Exists." + end + if obj.status.state == "NotFound" then + hs.status = "Missing" + hs.message = "Component state: NotFound." + end + if obj.status.state == "ConfigError" then + hs.status = "Degraded" + hs.message = "Component state: ConfigError." + end + if obj.status.state == "Unknown" then + hs.status = "Unknown" + hs.message = "Component state: Unknown." + end + if obj.status.state == "Unknown" then + hs.status = "Unknown" + hs.message = "Component state: Unknown." + end + end + return hs +end +return hs \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioAction/health_test.yaml b/resource_customizations/core.humio.com/HumioAction/health_test.yaml new file mode 100644 index 0000000000000..f90baf9bccc9f --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAction/health_test.yaml @@ -0,0 +1,21 @@ +tests: +- healthStatus: + status: Healthy + message: "Component state: Exists." + inputPath: testdata/healthy.yaml +- healthStatus: + status: Missing + message: "Component state: NotFound." + inputPath: testdata/notfound.yaml +- healthStatus: + status: Degraded + message: "Component state: ConfigError." + inputPath: testdata/configerror.yaml +- healthStatus: + status: Unknown + message: "Component state: Unknown." + inputPath: testdata/unknown.yaml +- healthStatus: + status: Progressing + message: "Update in progress" + inputPath: testdata/progressing.yaml diff --git a/resource_customizations/core.humio.com/HumioAction/testdata/configerror.yaml b/resource_customizations/core.humio.com/HumioAction/testdata/configerror.yaml new file mode 100644 index 0000000000000..1c986292f21a4 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAction/testdata/configerror.yaml @@ -0,0 +1,23 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioAction +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: test-action-1 + namespace: humio + resourceVersion: '10768054' + uid: f339ddf1-3b3e-49e0-80cc-7f583dce532e +spec: + humioRepositoryProperties: + ingestTokenSource: + secretKeyRef: + key: test-token + name: token + managedClusterName: example-humiocluster + name: trigger_action + viewName: example-1 +status: + state: ConfigError diff --git a/resource_customizations/core.humio.com/HumioAction/testdata/healthy.yaml b/resource_customizations/core.humio.com/HumioAction/testdata/healthy.yaml new file mode 100644 index 0000000000000..f6dfeffcf31a5 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAction/testdata/healthy.yaml @@ -0,0 +1,23 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioAction +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: test-action-1 + namespace: humio + resourceVersion: '10768054' + uid: f339ddf1-3b3e-49e0-80cc-7f583dce532e +spec: + humioRepositoryProperties: + ingestTokenSource: + secretKeyRef: + key: test-token + name: token + managedClusterName: example-humiocluster + name: trigger_action + viewName: example-1 +status: + state: Exists \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioAction/testdata/notfound.yaml b/resource_customizations/core.humio.com/HumioAction/testdata/notfound.yaml new file mode 100644 index 0000000000000..2743fb1b7b54b --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAction/testdata/notfound.yaml @@ -0,0 +1,23 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioAction +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: test-action-1 + namespace: humio + resourceVersion: '10768054' + uid: f339ddf1-3b3e-49e0-80cc-7f583dce532e +spec: + humioRepositoryProperties: + ingestTokenSource: + secretKeyRef: + key: test-token + name: token + managedClusterName: example-humiocluster + name: trigger_action + viewName: example-1 +status: + state: NotFound \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioAction/testdata/progressing.yaml b/resource_customizations/core.humio.com/HumioAction/testdata/progressing.yaml new file mode 100644 index 0000000000000..8a43ffc4fab01 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAction/testdata/progressing.yaml @@ -0,0 +1,21 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioAction +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: test-action-1 + namespace: humio + resourceVersion: '10768054' + uid: f339ddf1-3b3e-49e0-80cc-7f583dce532e +spec: + humioRepositoryProperties: + ingestTokenSource: + secretKeyRef: + key: test-token + name: token + managedClusterName: example-humiocluster + name: trigger_action + viewName: example-1 \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioAction/testdata/unknown.yaml b/resource_customizations/core.humio.com/HumioAction/testdata/unknown.yaml new file mode 100644 index 0000000000000..e3ec98cd557b4 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAction/testdata/unknown.yaml @@ -0,0 +1,23 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioAction +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: test-action-1 + namespace: humio + resourceVersion: '10768054' + uid: f339ddf1-3b3e-49e0-80cc-7f583dce532e +spec: + humioRepositoryProperties: + ingestTokenSource: + secretKeyRef: + key: test-token + name: token + managedClusterName: example-humiocluster + name: trigger_action + viewName: example-1 +status: + state: Unknown diff --git a/resource_customizations/core.humio.com/HumioAlert/health.lua b/resource_customizations/core.humio.com/HumioAlert/health.lua new file mode 100644 index 0000000000000..a99a0eb2e0d59 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAlert/health.lua @@ -0,0 +1,30 @@ +hs = { + status = "Progressing", + message = "Update in progress" +} +if obj.status ~= nil then + if obj.status.state ~= nil then + if obj.status.state == "Exists" then + hs.status = "Healthy" + hs.message = "Component state: Exists." + end + if obj.status.state == "NotFound" then + hs.status = "Missing" + hs.message = "Component state: NotFound." + end + if obj.status.state == "ConfigError" then + hs.status = "Degraded" + hs.message = "Component state: ConfigError." + end + if obj.status.state == "Unknown" then + hs.status = "Unknown" + hs.message = "Component state: Unknown." + end + if obj.status.state == "Unknown" then + hs.status = "Unknown" + hs.message = "Component state: Unknown." + end + end + return hs +end +return hs \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioAlert/health_test.yaml b/resource_customizations/core.humio.com/HumioAlert/health_test.yaml new file mode 100644 index 0000000000000..f90baf9bccc9f --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAlert/health_test.yaml @@ -0,0 +1,21 @@ +tests: +- healthStatus: + status: Healthy + message: "Component state: Exists." + inputPath: testdata/healthy.yaml +- healthStatus: + status: Missing + message: "Component state: NotFound." + inputPath: testdata/notfound.yaml +- healthStatus: + status: Degraded + message: "Component state: ConfigError." + inputPath: testdata/configerror.yaml +- healthStatus: + status: Unknown + message: "Component state: Unknown." + inputPath: testdata/unknown.yaml +- healthStatus: + status: Progressing + message: "Update in progress" + inputPath: testdata/progressing.yaml diff --git a/resource_customizations/core.humio.com/HumioAlert/testdata/configerror.yaml b/resource_customizations/core.humio.com/HumioAlert/testdata/configerror.yaml new file mode 100644 index 0000000000000..043d08d6a2d17 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAlert/testdata/configerror.yaml @@ -0,0 +1,29 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioAlert +metadata: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 3 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-alert-1 + namespace: humio + resourceVersion: '10768150' + uid: eb138512-0661-47c1-a056-0e53f3b5fa1f +spec: + actions: + - move-to-alerts + description: Error counts + labels: + - test-label + managedClusterName: example-humiocluster + name: example-alert + query: + queryString: '#repo = humio | error = true | count() | _count > 0' + start: 24h + silenced: false + throttleTimeMillis: 60000 + viewName: example-view +status: + state: ConfigError diff --git a/resource_customizations/core.humio.com/HumioAlert/testdata/healthy.yaml b/resource_customizations/core.humio.com/HumioAlert/testdata/healthy.yaml new file mode 100644 index 0000000000000..c62feb15a2943 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAlert/testdata/healthy.yaml @@ -0,0 +1,29 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioAlert +metadata: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 3 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-alert-1 + namespace: humio + resourceVersion: '10768150' + uid: eb138512-0661-47c1-a056-0e53f3b5fa1f +spec: + actions: + - move-to-alerts + description: Error counts + labels: + - test-label + managedClusterName: example-humiocluster + name: example-alert + query: + queryString: '#repo = humio | error = true | count() | _count > 0' + start: 24h + silenced: false + throttleTimeMillis: 60000 + viewName: example-view +status: + state: Exists \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioAlert/testdata/notfound.yaml b/resource_customizations/core.humio.com/HumioAlert/testdata/notfound.yaml new file mode 100644 index 0000000000000..f694bf3788e5e --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAlert/testdata/notfound.yaml @@ -0,0 +1,29 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioAlert +metadata: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 3 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-alert-1 + namespace: humio + resourceVersion: '10768150' + uid: eb138512-0661-47c1-a056-0e53f3b5fa1f +spec: + actions: + - move-to-alerts + description: Error counts + labels: + - test-label + managedClusterName: example-humiocluster + name: example-alert + query: + queryString: '#repo = humio | error = true | count() | _count > 0' + start: 24h + silenced: false + throttleTimeMillis: 60000 + viewName: example-view +status: + state: NotFound \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioAlert/testdata/progressing.yaml b/resource_customizations/core.humio.com/HumioAlert/testdata/progressing.yaml new file mode 100644 index 0000000000000..2740b020a9311 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAlert/testdata/progressing.yaml @@ -0,0 +1,27 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioAlert +metadata: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 3 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-alert-1 + namespace: humio + resourceVersion: '10768150' + uid: eb138512-0661-47c1-a056-0e53f3b5fa1f +spec: + actions: + - move-to-alerts + description: Error counts + labels: + - test-label + managedClusterName: example-humiocluster + name: example-alert + query: + queryString: '#repo = humio | error = true | count() | _count > 0' + start: 24h + silenced: false + throttleTimeMillis: 60000 + viewName: example-view \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioAlert/testdata/unknown.yaml b/resource_customizations/core.humio.com/HumioAlert/testdata/unknown.yaml new file mode 100644 index 0000000000000..edbf4b3355866 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioAlert/testdata/unknown.yaml @@ -0,0 +1,29 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioAlert +metadata: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 3 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-alert-1 + namespace: humio + resourceVersion: '10768150' + uid: eb138512-0661-47c1-a056-0e53f3b5fa1f +spec: + actions: + - move-to-alerts + description: Error counts + labels: + - test-label + managedClusterName: example-humiocluster + name: example-alert + query: + queryString: '#repo = humio | error = true | count() | _count > 0' + start: 24h + silenced: false + throttleTimeMillis: 60000 + viewName: example-view +status: + state: Unknown diff --git a/resource_customizations/core.humio.com/HumioCluster/health.lua b/resource_customizations/core.humio.com/HumioCluster/health.lua new file mode 100644 index 0000000000000..95a13ce855cec --- /dev/null +++ b/resource_customizations/core.humio.com/HumioCluster/health.lua @@ -0,0 +1,67 @@ + +hs = { + status = "Progressing", + message = "Update in progress" +} + +if obj.status == nil then + hs.status= "Progressing" + if obj.status.message ~= nil then + hs.message = obj.status.message + end +end + +if obj.status ~= nil then + if obj.status.state ~= nil then + if obj.status.state == "Running" then + hs.status = "Healthy" + if obj.status.message ~= nil then + hs.message = obj.status.message + else + hs.message = "Cluster is in a healthy running state" + end + end + if obj.status.state == "Restarting" then + hs.status = "Progressing" + if obj.status.message ~= nil then + hs.message = obj.status.message + else + hs.message = "Cluster pods are being restarted" + end + end + if obj.status.state == "Upgrading" then + hs.status = "Progressing" + if obj.status.message ~= nil then + hs.message = obj.status.message + else + hs.message = "Cluster pods are being upgraded" + end + end + if obj.status.state == "ConfigError" then + hs.status = "Degraded" + if obj.status.message ~= nil then + hs.message = obj.status.message + else + hs.message = "User-provided cluster specification resulted in a configuration error" + end + end + if obj.status.state == "Pending" then + hs.status = "Progressing" + if obj.status.message ~= nil then + hs.message = obj.status.message + else + hs.message = "Cluster is waiting on resources to be provisioned" + end + end + if obj.status.state == "Unknown" then + hs.status = "Unknown" + if obj.status.message ~= nil then + hs.message = obj.status.message + else + hs.message = "Component state: Unknown." + end + end + end + return hs +end +return hs \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioCluster/health_test.yaml b/resource_customizations/core.humio.com/HumioCluster/health_test.yaml new file mode 100644 index 0000000000000..cb3696d2cff93 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioCluster/health_test.yaml @@ -0,0 +1,29 @@ +tests: +- healthStatus: + status: Healthy + message: "Cluster is in a healthy running state" + inputPath: testdata/healthy.yaml +- healthStatus: + status: Progressing + message: "Cluster pods are being restarted" + inputPath: testdata/restarting.yaml +- healthStatus: + status: Progressing + message: "Cluster pods are being upgraded" + inputPath: testdata/upgrading.yaml +- healthStatus: + status: Progressing + message: "Cluster is waiting on resources to be provisioned" + inputPath: testdata/pending.yaml +- healthStatus: + status: Degraded + message: 'Secret "example-humiocluster-license" not found' + inputPath: testdata/configerror_custom.yaml +- healthStatus: + status: Degraded + message: 'User-provided cluster specification resulted in a configuration error' + inputPath: testdata/configerror.yaml +- healthStatus: + status: Unknown + message: "Component state: Unknown." + inputPath: testdata/unknown.yaml \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioCluster/testdata/configerror.yaml b/resource_customizations/core.humio.com/HumioCluster/testdata/configerror.yaml new file mode 100644 index 0000000000000..0998dd7deac86 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioCluster/testdata/configerror.yaml @@ -0,0 +1,30 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioCluster +metadata: + creationTimestamp: '2022-12-09T05:48:10Z' + generation: 1 + labels: + app: humio + app.kubernetes.io/instance: humio-cluster-failtest + name: example-humiocluster + namespace: failtes +spec: + dataVolumePersistentVolumeClaimSpecTemplate: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Gi + storageClassName: longhorn + digestPartitionsCount: 2 + image: 'humio/humio-core:latest' + license: + secretKeyRef: + key: data + name: example-humiocluster-license + storagePartitionsCount: 2 + targetReplicationFactor: 1 + tls: + enabled: false +status: + state: ConfigError diff --git a/resource_customizations/core.humio.com/HumioCluster/testdata/configerror_custom.yaml b/resource_customizations/core.humio.com/HumioCluster/testdata/configerror_custom.yaml new file mode 100644 index 0000000000000..545b9f33ba4ea --- /dev/null +++ b/resource_customizations/core.humio.com/HumioCluster/testdata/configerror_custom.yaml @@ -0,0 +1,33 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioCluster +metadata: + creationTimestamp: '2022-12-09T05:48:10Z' + generation: 1 + labels: + app: humio + app.kubernetes.io/instance: humio-cluster-failtest + name: example-humiocluster + namespace: failtes +spec: + dataVolumePersistentVolumeClaimSpecTemplate: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Gi + storageClassName: longhorn + digestPartitionsCount: 2 + image: 'humio/humio-core:latest' + license: + secretKeyRef: + key: data + name: example-humiocluster-license + storagePartitionsCount: 2 + targetReplicationFactor: 1 + tls: + enabled: false +status: + licenseStatus: {} + message: Secret "example-humiocluster-license" not found + observedGeneration: '1' + state: ConfigError diff --git a/resource_customizations/core.humio.com/HumioCluster/testdata/healthy.yaml b/resource_customizations/core.humio.com/HumioCluster/testdata/healthy.yaml new file mode 100644 index 0000000000000..4620df81e3159 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioCluster/testdata/healthy.yaml @@ -0,0 +1,30 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioCluster +metadata: + creationTimestamp: '2022-12-09T05:48:10Z' + generation: 1 + labels: + app: humio + app.kubernetes.io/instance: humio-cluster-failtest + name: example-humiocluster + namespace: failtes +spec: + dataVolumePersistentVolumeClaimSpecTemplate: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Gi + storageClassName: longhorn + digestPartitionsCount: 2 + image: 'humio/humio-core:latest' + license: + secretKeyRef: + key: data + name: example-humiocluster-license + storagePartitionsCount: 2 + targetReplicationFactor: 1 + tls: + enabled: false +status: + state: Running diff --git a/resource_customizations/core.humio.com/HumioCluster/testdata/pending.yaml b/resource_customizations/core.humio.com/HumioCluster/testdata/pending.yaml new file mode 100644 index 0000000000000..9cb591f5e56d9 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioCluster/testdata/pending.yaml @@ -0,0 +1,30 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioCluster +metadata: + creationTimestamp: '2022-12-09T05:48:10Z' + generation: 1 + labels: + app: humio + app.kubernetes.io/instance: humio-cluster-failtest + name: example-humiocluster + namespace: failtes +spec: + dataVolumePersistentVolumeClaimSpecTemplate: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Gi + storageClassName: longhorn + digestPartitionsCount: 2 + image: 'humio/humio-core:latest' + license: + secretKeyRef: + key: data + name: example-humiocluster-license + storagePartitionsCount: 2 + targetReplicationFactor: 1 + tls: + enabled: false +status: + state: Pending diff --git a/resource_customizations/core.humio.com/HumioCluster/testdata/progressing.yaml b/resource_customizations/core.humio.com/HumioCluster/testdata/progressing.yaml new file mode 100644 index 0000000000000..78a6fd893dd1c --- /dev/null +++ b/resource_customizations/core.humio.com/HumioCluster/testdata/progressing.yaml @@ -0,0 +1,28 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioCluster +metadata: + creationTimestamp: '2022-12-09T05:48:10Z' + generation: 1 + labels: + app: humio + app.kubernetes.io/instance: humio-cluster-failtest + name: example-humiocluster + namespace: failtes +spec: + dataVolumePersistentVolumeClaimSpecTemplate: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Gi + storageClassName: longhorn + digestPartitionsCount: 2 + image: 'humio/humio-core:latest' + license: + secretKeyRef: + key: data + name: example-humiocluster-license + storagePartitionsCount: 2 + targetReplicationFactor: 1 + tls: + enabled: false diff --git a/resource_customizations/core.humio.com/HumioCluster/testdata/restarting.yaml b/resource_customizations/core.humio.com/HumioCluster/testdata/restarting.yaml new file mode 100644 index 0000000000000..84943fe0484c1 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioCluster/testdata/restarting.yaml @@ -0,0 +1,30 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioCluster +metadata: + creationTimestamp: '2022-12-09T05:48:10Z' + generation: 1 + labels: + app: humio + app.kubernetes.io/instance: humio-cluster-failtest + name: example-humiocluster + namespace: failtes +spec: + dataVolumePersistentVolumeClaimSpecTemplate: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Gi + storageClassName: longhorn + digestPartitionsCount: 2 + image: 'humio/humio-core:latest' + license: + secretKeyRef: + key: data + name: example-humiocluster-license + storagePartitionsCount: 2 + targetReplicationFactor: 1 + tls: + enabled: false +status: + state: Restarting diff --git a/resource_customizations/core.humio.com/HumioCluster/testdata/unknown.yaml b/resource_customizations/core.humio.com/HumioCluster/testdata/unknown.yaml new file mode 100644 index 0000000000000..1d08a2e885795 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioCluster/testdata/unknown.yaml @@ -0,0 +1,33 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioCluster +metadata: + creationTimestamp: '2022-12-09T05:48:10Z' + generation: 1 + labels: + app: humio + app.kubernetes.io/instance: humio-cluster-failtest + name: example-humiocluster + namespace: failtes +spec: + dataVolumePersistentVolumeClaimSpecTemplate: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Gi + storageClassName: longhorn + digestPartitionsCount: 2 + image: 'humio/humio-core:latest' + license: + secretKeyRef: + key: data + name: example-humiocluster-license + storagePartitionsCount: 2 + targetReplicationFactor: 1 + tls: + enabled: false +status: + state: Unknown + + + diff --git a/resource_customizations/core.humio.com/HumioCluster/testdata/upgrading.yaml b/resource_customizations/core.humio.com/HumioCluster/testdata/upgrading.yaml new file mode 100644 index 0000000000000..76a322288aab0 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioCluster/testdata/upgrading.yaml @@ -0,0 +1,33 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioCluster +metadata: + creationTimestamp: '2022-12-09T05:48:10Z' + generation: 1 + labels: + app: humio + app.kubernetes.io/instance: humio-cluster-failtest + name: example-humiocluster + namespace: failtes +spec: + dataVolumePersistentVolumeClaimSpecTemplate: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 100Gi + storageClassName: longhorn + digestPartitionsCount: 2 + image: 'humio/humio-core:latest' + license: + secretKeyRef: + key: data + name: example-humiocluster-license + storagePartitionsCount: 2 + targetReplicationFactor: 1 + tls: + enabled: false +status: + state: Upgrading + + + diff --git a/resource_customizations/core.humio.com/HumioIngestToken/health.lua b/resource_customizations/core.humio.com/HumioIngestToken/health.lua new file mode 100644 index 0000000000000..a99a0eb2e0d59 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioIngestToken/health.lua @@ -0,0 +1,30 @@ +hs = { + status = "Progressing", + message = "Update in progress" +} +if obj.status ~= nil then + if obj.status.state ~= nil then + if obj.status.state == "Exists" then + hs.status = "Healthy" + hs.message = "Component state: Exists." + end + if obj.status.state == "NotFound" then + hs.status = "Missing" + hs.message = "Component state: NotFound." + end + if obj.status.state == "ConfigError" then + hs.status = "Degraded" + hs.message = "Component state: ConfigError." + end + if obj.status.state == "Unknown" then + hs.status = "Unknown" + hs.message = "Component state: Unknown." + end + if obj.status.state == "Unknown" then + hs.status = "Unknown" + hs.message = "Component state: Unknown." + end + end + return hs +end +return hs \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioIngestToken/health_test.yaml b/resource_customizations/core.humio.com/HumioIngestToken/health_test.yaml new file mode 100644 index 0000000000000..f90baf9bccc9f --- /dev/null +++ b/resource_customizations/core.humio.com/HumioIngestToken/health_test.yaml @@ -0,0 +1,21 @@ +tests: +- healthStatus: + status: Healthy + message: "Component state: Exists." + inputPath: testdata/healthy.yaml +- healthStatus: + status: Missing + message: "Component state: NotFound." + inputPath: testdata/notfound.yaml +- healthStatus: + status: Degraded + message: "Component state: ConfigError." + inputPath: testdata/configerror.yaml +- healthStatus: + status: Unknown + message: "Component state: Unknown." + inputPath: testdata/unknown.yaml +- healthStatus: + status: Progressing + message: "Update in progress" + inputPath: testdata/progressing.yaml diff --git a/resource_customizations/core.humio.com/HumioIngestToken/testdata/configerror.yaml b/resource_customizations/core.humio.com/HumioIngestToken/testdata/configerror.yaml new file mode 100644 index 0000000000000..df1ed30141ded --- /dev/null +++ b/resource_customizations/core.humio.com/HumioIngestToken/testdata/configerror.yaml @@ -0,0 +1,20 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioIngestToken +metadata: + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: test-token-1 + namespace: humio + resourceVersion: '10768058' + uid: f0a51e3d-8b64-483c-99fa-d7184a840707 +spec: + managedClusterName: example-humiocluster + name: test-token + parserName: json + repositoryName: example-1 + tokenSecretName: example-test-token-1 +status: + state: ConfigError diff --git a/resource_customizations/core.humio.com/HumioIngestToken/testdata/healthy.yaml b/resource_customizations/core.humio.com/HumioIngestToken/testdata/healthy.yaml new file mode 100644 index 0000000000000..3eb03b98569b8 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioIngestToken/testdata/healthy.yaml @@ -0,0 +1,20 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioIngestToken +metadata: + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: test-token-1 + namespace: humio + resourceVersion: '10768058' + uid: f0a51e3d-8b64-483c-99fa-d7184a840707 +spec: + managedClusterName: example-humiocluster + name: test-token + parserName: json + repositoryName: example-1 + tokenSecretName: example-test-token-1 +status: + state: Exists diff --git a/resource_customizations/core.humio.com/HumioIngestToken/testdata/notfound.yaml b/resource_customizations/core.humio.com/HumioIngestToken/testdata/notfound.yaml new file mode 100644 index 0000000000000..6d36afdc1ef04 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioIngestToken/testdata/notfound.yaml @@ -0,0 +1,20 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioIngestToken +metadata: + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: test-token-1 + namespace: humio + resourceVersion: '10768058' + uid: f0a51e3d-8b64-483c-99fa-d7184a840707 +spec: + managedClusterName: example-humiocluster + name: test-token + parserName: json + repositoryName: example-1 + tokenSecretName: example-test-token-1 +status: + state: NotFound \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioIngestToken/testdata/progressing.yaml b/resource_customizations/core.humio.com/HumioIngestToken/testdata/progressing.yaml new file mode 100644 index 0000000000000..5dd35fc65c62a --- /dev/null +++ b/resource_customizations/core.humio.com/HumioIngestToken/testdata/progressing.yaml @@ -0,0 +1,18 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioIngestToken +metadata: + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: test-token-1 + namespace: humio + resourceVersion: '10768058' + uid: f0a51e3d-8b64-483c-99fa-d7184a840707 +spec: + managedClusterName: example-humiocluster + name: test-token + parserName: json + repositoryName: example-1 + tokenSecretName: example-test-token-1 \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioIngestToken/testdata/unknown.yaml b/resource_customizations/core.humio.com/HumioIngestToken/testdata/unknown.yaml new file mode 100644 index 0000000000000..3b5a50e620823 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioIngestToken/testdata/unknown.yaml @@ -0,0 +1,20 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioIngestToken +metadata: + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: test-token-1 + namespace: humio + resourceVersion: '10768058' + uid: f0a51e3d-8b64-483c-99fa-d7184a840707 +spec: + managedClusterName: example-humiocluster + name: test-token + parserName: json + repositoryName: example-1 + tokenSecretName: example-test-token-1 +status: + state: Unknown diff --git a/resource_customizations/core.humio.com/HumioParser/health.lua b/resource_customizations/core.humio.com/HumioParser/health.lua new file mode 100644 index 0000000000000..a99a0eb2e0d59 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioParser/health.lua @@ -0,0 +1,30 @@ +hs = { + status = "Progressing", + message = "Update in progress" +} +if obj.status ~= nil then + if obj.status.state ~= nil then + if obj.status.state == "Exists" then + hs.status = "Healthy" + hs.message = "Component state: Exists." + end + if obj.status.state == "NotFound" then + hs.status = "Missing" + hs.message = "Component state: NotFound." + end + if obj.status.state == "ConfigError" then + hs.status = "Degraded" + hs.message = "Component state: ConfigError." + end + if obj.status.state == "Unknown" then + hs.status = "Unknown" + hs.message = "Component state: Unknown." + end + if obj.status.state == "Unknown" then + hs.status = "Unknown" + hs.message = "Component state: Unknown." + end + end + return hs +end +return hs \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioParser/health_test.yaml b/resource_customizations/core.humio.com/HumioParser/health_test.yaml new file mode 100644 index 0000000000000..f90baf9bccc9f --- /dev/null +++ b/resource_customizations/core.humio.com/HumioParser/health_test.yaml @@ -0,0 +1,21 @@ +tests: +- healthStatus: + status: Healthy + message: "Component state: Exists." + inputPath: testdata/healthy.yaml +- healthStatus: + status: Missing + message: "Component state: NotFound." + inputPath: testdata/notfound.yaml +- healthStatus: + status: Degraded + message: "Component state: ConfigError." + inputPath: testdata/configerror.yaml +- healthStatus: + status: Unknown + message: "Component state: Unknown." + inputPath: testdata/unknown.yaml +- healthStatus: + status: Progressing + message: "Update in progress" + inputPath: testdata/progressing.yaml diff --git a/resource_customizations/core.humio.com/HumioParser/testdata/configerror.yaml b/resource_customizations/core.humio.com/HumioParser/testdata/configerror.yaml new file mode 100644 index 0000000000000..f1334b3110848 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioParser/testdata/configerror.yaml @@ -0,0 +1,39 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioParser +metadata: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-1-parser + namespace: humio + resourceVersion: '10768079' + uid: 5641590d-b8e9-42e8-a544-d0673bf0e1a2 +spec: + managedClusterName: example-humiocluster + name: example-1 + parserScript: > + /(?\S+)\s+-\s+(?\S+)\s+\[(?<@timestamp>.*)\]\s+"((?\S+)\s+(?\S+)?\s+(?\S+)?|-)"\s+(?\d+)\s+(?\S+)\s+"(?[^"]*)"\s+"(?[^"]*)"\s*(?(\d|\.)+)?/ + | parseTimestamp(format="dd/MMM/yyyy:HH:mm:ss Z", field=@timestamp) + repositoryName: example-repo + tagFields: + - statuscode + - client + testData: + - >- + 4.4.4.4 - - [12/Dec/2015:18:25:11 +0100] "GET /administrator/ + HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) + Gecko/20100101 Firefox/34.0" "-" + - >- + 4.4.4.4 - - [12/Dec/2015:18:25:11 +0100] "POST + /administrator/index.php HTTP/1.1" 200 4494 + "http://github.com/administrator/" "Mozilla/5.0 (Windows NT 6.0; + rv:34.0) Gecko/20100101 Firefox/34.0" "-" + - >- + 4.4.4.4 - - [12/Dec/2015:18:31:08 +0100] "GET /administrator/ + HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) + Gecko/20100101 Firefox/34.0" "-" +status: + state: ConfigError diff --git a/resource_customizations/core.humio.com/HumioParser/testdata/healthy.yaml b/resource_customizations/core.humio.com/HumioParser/testdata/healthy.yaml new file mode 100644 index 0000000000000..9a4d92d25c75a --- /dev/null +++ b/resource_customizations/core.humio.com/HumioParser/testdata/healthy.yaml @@ -0,0 +1,39 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioParser +metadata: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-1-parser + namespace: humio + resourceVersion: '10768079' + uid: 5641590d-b8e9-42e8-a544-d0673bf0e1a2 +spec: + managedClusterName: example-humiocluster + name: example-1 + parserScript: > + /(?\S+)\s+-\s+(?\S+)\s+\[(?<@timestamp>.*)\]\s+"((?\S+)\s+(?\S+)?\s+(?\S+)?|-)"\s+(?\d+)\s+(?\S+)\s+"(?[^"]*)"\s+"(?[^"]*)"\s*(?(\d|\.)+)?/ + | parseTimestamp(format="dd/MMM/yyyy:HH:mm:ss Z", field=@timestamp) + repositoryName: example-repo + tagFields: + - statuscode + - client + testData: + - >- + 4.4.4.4 - - [12/Dec/2015:18:25:11 +0100] "GET /administrator/ + HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) + Gecko/20100101 Firefox/34.0" "-" + - >- + 4.4.4.4 - - [12/Dec/2015:18:25:11 +0100] "POST + /administrator/index.php HTTP/1.1" 200 4494 + "http://github.com/administrator/" "Mozilla/5.0 (Windows NT 6.0; + rv:34.0) Gecko/20100101 Firefox/34.0" "-" + - >- + 4.4.4.4 - - [12/Dec/2015:18:31:08 +0100] "GET /administrator/ + HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) + Gecko/20100101 Firefox/34.0" "-" +status: + state: Exists diff --git a/resource_customizations/core.humio.com/HumioParser/testdata/notfound.yaml b/resource_customizations/core.humio.com/HumioParser/testdata/notfound.yaml new file mode 100644 index 0000000000000..87565368f42c5 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioParser/testdata/notfound.yaml @@ -0,0 +1,39 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioParser +metadata: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-1-parser + namespace: humio + resourceVersion: '10768079' + uid: 5641590d-b8e9-42e8-a544-d0673bf0e1a2 +spec: + managedClusterName: example-humiocluster + name: example-1 + parserScript: > + /(?\S+)\s+-\s+(?\S+)\s+\[(?<@timestamp>.*)\]\s+"((?\S+)\s+(?\S+)?\s+(?\S+)?|-)"\s+(?\d+)\s+(?\S+)\s+"(?[^"]*)"\s+"(?[^"]*)"\s*(?(\d|\.)+)?/ + | parseTimestamp(format="dd/MMM/yyyy:HH:mm:ss Z", field=@timestamp) + repositoryName: example-repo + tagFields: + - statuscode + - client + testData: + - >- + 4.4.4.4 - - [12/Dec/2015:18:25:11 +0100] "GET /administrator/ + HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) + Gecko/20100101 Firefox/34.0" "-" + - >- + 4.4.4.4 - - [12/Dec/2015:18:25:11 +0100] "POST + /administrator/index.php HTTP/1.1" 200 4494 + "http://github.com/administrator/" "Mozilla/5.0 (Windows NT 6.0; + rv:34.0) Gecko/20100101 Firefox/34.0" "-" + - >- + 4.4.4.4 - - [12/Dec/2015:18:31:08 +0100] "GET /administrator/ + HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) + Gecko/20100101 Firefox/34.0" "-" +status: + state: NotFound \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioParser/testdata/progressing.yaml b/resource_customizations/core.humio.com/HumioParser/testdata/progressing.yaml new file mode 100644 index 0000000000000..e46557b7931e2 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioParser/testdata/progressing.yaml @@ -0,0 +1,37 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioParser +metadata: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-1-parser + namespace: humio + resourceVersion: '10768079' + uid: 5641590d-b8e9-42e8-a544-d0673bf0e1a2 +spec: + managedClusterName: example-humiocluster + name: example-1 + parserScript: > + /(?\S+)\s+-\s+(?\S+)\s+\[(?<@timestamp>.*)\]\s+"((?\S+)\s+(?\S+)?\s+(?\S+)?|-)"\s+(?\d+)\s+(?\S+)\s+"(?[^"]*)"\s+"(?[^"]*)"\s*(?(\d|\.)+)?/ + | parseTimestamp(format="dd/MMM/yyyy:HH:mm:ss Z", field=@timestamp) + repositoryName: example-repo + tagFields: + - statuscode + - client + testData: + - >- + 4.4.4.4 - - [12/Dec/2015:18:25:11 +0100] "GET /administrator/ + HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) + Gecko/20100101 Firefox/34.0" "-" + - >- + 4.4.4.4 - - [12/Dec/2015:18:25:11 +0100] "POST + /administrator/index.php HTTP/1.1" 200 4494 + "http://github.com/administrator/" "Mozilla/5.0 (Windows NT 6.0; + rv:34.0) Gecko/20100101 Firefox/34.0" "-" + - >- + 4.4.4.4 - - [12/Dec/2015:18:31:08 +0100] "GET /administrator/ + HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) + Gecko/20100101 Firefox/34.0" "-" \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioParser/testdata/unknown.yaml b/resource_customizations/core.humio.com/HumioParser/testdata/unknown.yaml new file mode 100644 index 0000000000000..9def4c7cbba62 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioParser/testdata/unknown.yaml @@ -0,0 +1,39 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioParser +metadata: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-1-parser + namespace: humio + resourceVersion: '10768079' + uid: 5641590d-b8e9-42e8-a544-d0673bf0e1a2 +spec: + managedClusterName: example-humiocluster + name: example-1 + parserScript: > + /(?\S+)\s+-\s+(?\S+)\s+\[(?<@timestamp>.*)\]\s+"((?\S+)\s+(?\S+)?\s+(?\S+)?|-)"\s+(?\d+)\s+(?\S+)\s+"(?[^"]*)"\s+"(?[^"]*)"\s*(?(\d|\.)+)?/ + | parseTimestamp(format="dd/MMM/yyyy:HH:mm:ss Z", field=@timestamp) + repositoryName: example-repo + tagFields: + - statuscode + - client + testData: + - >- + 4.4.4.4 - - [12/Dec/2015:18:25:11 +0100] "GET /administrator/ + HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) + Gecko/20100101 Firefox/34.0" "-" + - >- + 4.4.4.4 - - [12/Dec/2015:18:25:11 +0100] "POST + /administrator/index.php HTTP/1.1" 200 4494 + "http://github.com/administrator/" "Mozilla/5.0 (Windows NT 6.0; + rv:34.0) Gecko/20100101 Firefox/34.0" "-" + - >- + 4.4.4.4 - - [12/Dec/2015:18:31:08 +0100] "GET /administrator/ + HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) + Gecko/20100101 Firefox/34.0" "-" +status: + state: Unknown diff --git a/resource_customizations/core.humio.com/HumioRepository/health.lua b/resource_customizations/core.humio.com/HumioRepository/health.lua new file mode 100644 index 0000000000000..a99a0eb2e0d59 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioRepository/health.lua @@ -0,0 +1,30 @@ +hs = { + status = "Progressing", + message = "Update in progress" +} +if obj.status ~= nil then + if obj.status.state ~= nil then + if obj.status.state == "Exists" then + hs.status = "Healthy" + hs.message = "Component state: Exists." + end + if obj.status.state == "NotFound" then + hs.status = "Missing" + hs.message = "Component state: NotFound." + end + if obj.status.state == "ConfigError" then + hs.status = "Degraded" + hs.message = "Component state: ConfigError." + end + if obj.status.state == "Unknown" then + hs.status = "Unknown" + hs.message = "Component state: Unknown." + end + if obj.status.state == "Unknown" then + hs.status = "Unknown" + hs.message = "Component state: Unknown." + end + end + return hs +end +return hs \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioRepository/health_test.yaml b/resource_customizations/core.humio.com/HumioRepository/health_test.yaml new file mode 100644 index 0000000000000..f90baf9bccc9f --- /dev/null +++ b/resource_customizations/core.humio.com/HumioRepository/health_test.yaml @@ -0,0 +1,21 @@ +tests: +- healthStatus: + status: Healthy + message: "Component state: Exists." + inputPath: testdata/healthy.yaml +- healthStatus: + status: Missing + message: "Component state: NotFound." + inputPath: testdata/notfound.yaml +- healthStatus: + status: Degraded + message: "Component state: ConfigError." + inputPath: testdata/configerror.yaml +- healthStatus: + status: Unknown + message: "Component state: Unknown." + inputPath: testdata/unknown.yaml +- healthStatus: + status: Progressing + message: "Update in progress" + inputPath: testdata/progressing.yaml diff --git a/resource_customizations/core.humio.com/HumioRepository/testdata/configerror.yaml b/resource_customizations/core.humio.com/HumioRepository/testdata/configerror.yaml new file mode 100644 index 0000000000000..01286b1f77b0b --- /dev/null +++ b/resource_customizations/core.humio.com/HumioRepository/testdata/configerror.yaml @@ -0,0 +1,24 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioRepository +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 3 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-repo-1 + namespace: humio + resourceVersion: '10768154' + uid: bb626adb-1cdd-4db2-baa8-ae5e30132603 +spec: + description: example description + managedClusterName: example-humiocluster + name: example-repo + retention: + ingestSizeInGB: 4 + storageSizeInGB: 50 + timeInDays: 730 +status: + state: ConfigError diff --git a/resource_customizations/core.humio.com/HumioRepository/testdata/healthy.yaml b/resource_customizations/core.humio.com/HumioRepository/testdata/healthy.yaml new file mode 100644 index 0000000000000..2b2443047faf9 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioRepository/testdata/healthy.yaml @@ -0,0 +1,24 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioRepository +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 3 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-repo-1 + namespace: humio + resourceVersion: '10768154' + uid: bb626adb-1cdd-4db2-baa8-ae5e30132603 +spec: + description: example description + managedClusterName: example-humiocluster + name: example-repo + retention: + ingestSizeInGB: 4 + storageSizeInGB: 50 + timeInDays: 730 +status: + state: Exists \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioRepository/testdata/notfound.yaml b/resource_customizations/core.humio.com/HumioRepository/testdata/notfound.yaml new file mode 100644 index 0000000000000..86a3c6cfa10ef --- /dev/null +++ b/resource_customizations/core.humio.com/HumioRepository/testdata/notfound.yaml @@ -0,0 +1,24 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioRepository +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 3 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-repo-1 + namespace: humio + resourceVersion: '10768154' + uid: bb626adb-1cdd-4db2-baa8-ae5e30132603 +spec: + description: example description + managedClusterName: example-humiocluster + name: example-repo + retention: + ingestSizeInGB: 4 + storageSizeInGB: 50 + timeInDays: 730 +status: + state: NotFound \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioRepository/testdata/progressing.yaml b/resource_customizations/core.humio.com/HumioRepository/testdata/progressing.yaml new file mode 100644 index 0000000000000..9c40d176e131e --- /dev/null +++ b/resource_customizations/core.humio.com/HumioRepository/testdata/progressing.yaml @@ -0,0 +1,22 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioRepository +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 3 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-repo-1 + namespace: humio + resourceVersion: '10768154' + uid: bb626adb-1cdd-4db2-baa8-ae5e30132603 +spec: + description: example description + managedClusterName: example-humiocluster + name: example-repo + retention: + ingestSizeInGB: 4 + storageSizeInGB: 50 + timeInDays: 730 \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioRepository/testdata/unknown.yaml b/resource_customizations/core.humio.com/HumioRepository/testdata/unknown.yaml new file mode 100644 index 0000000000000..22d343a44eec8 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioRepository/testdata/unknown.yaml @@ -0,0 +1,24 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioRepository +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 3 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-repo-1 + namespace: humio + resourceVersion: '10768154' + uid: bb626adb-1cdd-4db2-baa8-ae5e30132603 +spec: + description: example description + managedClusterName: example-humiocluster + name: example-repo + retention: + ingestSizeInGB: 4 + storageSizeInGB: 50 + timeInDays: 730 +status: + state: Unknown diff --git a/resource_customizations/core.humio.com/HumioView/health.lua b/resource_customizations/core.humio.com/HumioView/health.lua new file mode 100644 index 0000000000000..e11956922fb7a --- /dev/null +++ b/resource_customizations/core.humio.com/HumioView/health.lua @@ -0,0 +1,26 @@ +hs = { + status = "Progressing", + message = "Update in progress" +} +if obj.status ~= nil then + if obj.status.state ~= nil then + if obj.status.state == "Exists" then + hs.status = "Healthy" + hs.message = "Component state: Exists." + end + if obj.status.state == "NotFound" then + hs.status = "Missing" + hs.message = "Component state: NotFound." + end + if obj.status.state == "ConfigError" then + hs.status = "Degraded" + hs.message = "Component state: ConfigError." + end + if obj.status.state == "Unknown" then + hs.status = "Unknown" + hs.message = "Component state: Unknown." + end + end + return hs +end +return hs diff --git a/resource_customizations/core.humio.com/HumioView/health_test.yaml b/resource_customizations/core.humio.com/HumioView/health_test.yaml new file mode 100644 index 0000000000000..f90baf9bccc9f --- /dev/null +++ b/resource_customizations/core.humio.com/HumioView/health_test.yaml @@ -0,0 +1,21 @@ +tests: +- healthStatus: + status: Healthy + message: "Component state: Exists." + inputPath: testdata/healthy.yaml +- healthStatus: + status: Missing + message: "Component state: NotFound." + inputPath: testdata/notfound.yaml +- healthStatus: + status: Degraded + message: "Component state: ConfigError." + inputPath: testdata/configerror.yaml +- healthStatus: + status: Unknown + message: "Component state: Unknown." + inputPath: testdata/unknown.yaml +- healthStatus: + status: Progressing + message: "Update in progress" + inputPath: testdata/progressing.yaml diff --git a/resource_customizations/core.humio.com/HumioView/testdata/configerror.yaml b/resource_customizations/core.humio.com/HumioView/testdata/configerror.yaml new file mode 100644 index 0000000000000..917c1c8b5eaab --- /dev/null +++ b/resource_customizations/core.humio.com/HumioView/testdata/configerror.yaml @@ -0,0 +1,24 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioView +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-view + namespace: humio + resourceVersion: '10768121' + uid: 2c49ac77-1be2-4e2c-a473-44f3f0e03453 +spec: + connections: + - filter: '*' + repositoryName: example-1 + - filter: '*' + repositoryName: example-2 + managedClusterName: example-humiocluster + name: example-view +status: + state: ConfigError diff --git a/resource_customizations/core.humio.com/HumioView/testdata/healthy.yaml b/resource_customizations/core.humio.com/HumioView/testdata/healthy.yaml new file mode 100644 index 0000000000000..7c75082be60a0 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioView/testdata/healthy.yaml @@ -0,0 +1,24 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioView +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-view + namespace: humio + resourceVersion: '10768121' + uid: 2c49ac77-1be2-4e2c-a473-44f3f0e03453 +spec: + connections: + - filter: '*' + repositoryName: example-1 + - filter: '*' + repositoryName: example-2 + managedClusterName: example-humiocluster + name: example-view +status: + state: Exists \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioView/testdata/notfound.yaml b/resource_customizations/core.humio.com/HumioView/testdata/notfound.yaml new file mode 100644 index 0000000000000..2d929ef2ae584 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioView/testdata/notfound.yaml @@ -0,0 +1,24 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioView +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-view + namespace: humio + resourceVersion: '10768121' + uid: 2c49ac77-1be2-4e2c-a473-44f3f0e03453 +spec: + connections: + - filter: '*' + repositoryName: example-1 + - filter: '*' + repositoryName: example-2 + managedClusterName: example-humiocluster + name: example-view +status: + state: NotFound \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioView/testdata/progressing.yaml b/resource_customizations/core.humio.com/HumioView/testdata/progressing.yaml new file mode 100644 index 0000000000000..4b44ad4cbbf83 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioView/testdata/progressing.yaml @@ -0,0 +1,22 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioView +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-view + namespace: humio + resourceVersion: '10768121' + uid: 2c49ac77-1be2-4e2c-a473-44f3f0e03453 +spec: + connections: + - filter: '*' + repositoryName: example-1 + - filter: '*' + repositoryName: example-2 + managedClusterName: example-humiocluster + name: example-view \ No newline at end of file diff --git a/resource_customizations/core.humio.com/HumioView/testdata/unknown.yaml b/resource_customizations/core.humio.com/HumioView/testdata/unknown.yaml new file mode 100644 index 0000000000000..ac4453048e0e7 --- /dev/null +++ b/resource_customizations/core.humio.com/HumioView/testdata/unknown.yaml @@ -0,0 +1,24 @@ +apiVersion: core.humio.com/v1alpha1 +kind: HumioView +metadata: + annotations: + creationTimestamp: '2022-12-08T02:03:07Z' + finalizers: + - core.humio.com/finalizer + generation: 1 + labels: + app.kubernetes.io/instance: humio-deploy + name: example-view + namespace: humio + resourceVersion: '10768121' + uid: 2c49ac77-1be2-4e2c-a473-44f3f0e03453 +spec: + connections: + - filter: '*' + repositoryName: example-1 + - filter: '*' + repositoryName: example-2 + managedClusterName: example-humiocluster + name: example-view +status: + state: Unknown