diff --git a/pkg/splunk/common/testdata/fixtures/apply_app_listing_config_map.json b/pkg/splunk/common/testdata/fixtures/apply_app_listing_config_map.json new file mode 100644 index 000000000..f26504f98 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/apply_app_listing_config_map.json @@ -0,0 +1,294 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-example-cluster-master", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "ClusterMaster", + "name": "example", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-example-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-example-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-example-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-example-indexer" + }, + "annotations": { + "appListingRev": "", + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-example-cluster-master-secret-v1", + "defaultMode": 420 + } + }, + { + "name": "mnt-app-listing", + "configMap": { + "name": "splunk-example-clustermaster-app-list", + "items": [ + { + "key": "app-list-cluster-with-pre-config.yaml", + "path": "app-list-cluster-with-pre-config.yaml", + "mode": 420 + }, + { + "key": "app-list-cluster.yaml", + "path": "app-list-cluster.yaml", + "mode": 420 + }, + { + "key": "app-list-local.yaml", + "path": "app-list-local.yaml", + "mode": 420 + }, + { + "key": "appsUpdateToken", + "path": "appsUpdateToken", + "mode": 420 + } + ], + "defaultMode": 420 + } + }, + { + "name": "init-apps", + "emptyDir": {} + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/app-listing/app-list-local.yaml,/mnt/app-listing/app-list-cluster.yaml,/mnt/app-listing/app-list-cluster-with-pre-config.yaml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_cluster_master" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + }, + { + "name": "mnt-app-listing", + "mountPath": "/mnt/app-listing/" + }, + { + "name": "init-apps", + "mountPath": "/init-apps/" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 1800, + "timeoutSeconds": 30, + "periodSeconds": 30 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 16 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-example-cluster-master" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-example-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-example-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-example-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-example-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-example-cluster-master-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "availableReplicas": 0, + "replicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_cluster_info.json b/pkg/splunk/common/testdata/fixtures/get_cluster_info.json new file mode 100644 index 000000000..fc09e7471 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_cluster_info.json @@ -0,0 +1,98 @@ +{ + "links": {}, + "origin": "https://localhost:8089/services/server/info", + "updated": "2020-09-24T06:38:53+00:00", + "generator": { + "build": "a1a6394cc5ae", + "version": "8.0.5" + }, + "entry": [ + { + "name": "server-info", + "id": "https://localhost:8089/services/server/info/server-info", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/server/info/server-info", + "list": "/services/server/info/server-info" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "*" + ], + "write": [] + }, + "removable": false, + "sharing": "system" + }, + "fields": { + "required": [], + "optional": [], + "wildcard": [] + }, + "content": { + "activeLicenseGroup": "Trial", + "activeLicenseSubgroup": "Production", + "build": "a1a6394cc5ae", + "cluster_label": [ + "idxc_label" + ], + "cpu_arch": "x86_64", + "eai:acl": null, + "fips_mode": false, + "guid": "0F93F33C-4BDA-4A74-AD9F-3FCE26C6AFF0", + "health_info": "green", + "health_version": 1, + "host": "splunk-default-monitoring-console-86bc9b7c8c-d96x2", + "host_fqdn": "splunk-default-monitoring-console-86bc9b7c8c-d96x2", + "host_resolved": "splunk-default-monitoring-console-86bc9b7c8c-d96x2", + "isForwarding": true, + "isFree": false, + "isTrial": true, + "kvStoreStatus": "ready", + "licenseKeys": [ + "5C52DA5145AD67B8188604C49962D12F2C3B2CF1B82A6878E46F68CA2812807B" + ], + "licenseSignature": "139bf73ec92c84121c79a9b8307a6724", + "licenseState": "OK", + "license_labels": [ + "Splunk Enterprise Splunk Analytics for Hadoop Download Trial" + ], + "master_guid": "0F93F33C-4BDA-4A74-AD9F-3FCE26C6AFF0", + "master_uri": "self", + "max_users": 4294967295, + "mode": "normal", + "numberOfCores": 1, + "numberOfVirtualCores": 2, + "os_build": "#1 SMP Thu Sep 3 19:04:44 UTC 2020", + "os_name": "Linux", + "os_name_extended": "Linux", + "os_version": "4.14.193-149.317.amzn2.x86_64", + "physicalMemoryMB": 7764, + "product_type": "enterprise", + "rtsearch_enabled": true, + "serverName": "splunk-default-monitoring-console-86bc9b7c8c-d96x2", + "server_roles": [ + "license_master", + "cluster_search_head", + "search_head" + ], + "startup_time": 1600928786, + "staticAssetId": "CFE3D41EE2CCD1465E8C8453F83E4ECFFF540780B4490E84458DD4A3694CE4D1", + "version": "8.0.5" + } + } + ], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/get_cm_info.json b/pkg/splunk/common/testdata/fixtures/get_cm_info.json new file mode 100644 index 000000000..ae0b510da --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_cm_info.json @@ -0,0 +1,100 @@ +{ + "links": {}, + "origin": "https://localhost:8089/services/cluster/master/info", + "updated": "2020-03-18T01:04:53+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [ + { + "name": "master", + "id": "https://localhost:8089/services/cluster/master/info/master", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/master/info/master", + "list": "/services/cluster/master/info/master" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "active_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "timestamp": 1583870198 + }, + "apply_bundle_status": { + "invalid_bundle": { + "bundle_path": "", + "bundle_validation_errors_on_master": [], + "checksum": "", + "timestamp": 0 + }, + "reload_bundle_issued": false, + "status": "None" + }, + "backup_and_restore_primaries": false, + "controlled_rolling_restart_flag": false, + "eai:acl": null, + "indexing_ready_flag": true, + "initialized_flag": true, + "label": "splunk-s1-cluster-master-0", + "last_check_restart_bundle_result": false, + "last_dry_run_bundle": { + "bundle_path": "", + "checksum": "", + "timestamp": 0 + }, + "last_validated_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/0af7c0e95f313f7be3b0cb1d878df9a1-1583948640.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "is_valid_bundle": true, + "timestamp": 1583948640 + }, + "latest_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "timestamp": 1583870198 + }, + "maintenance_mode": false, + "multisite": false, + "previous_active_bundle": { + "bundle_path": "", + "checksum": "", + "timestamp": 0 + }, + "primaries_backup_status": "No on-going (or) completed primaries backup yet. Check back again in few minutes if you expect a backup.", + "quiet_period_flag": false, + "rolling_restart_flag": false, + "rolling_restart_or_upgrade": false, + "service_ready_flag": true, + "start_time": 1583948636, + "summary_replication": "false" + } + } + ], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/get_cm_info_empty.json b/pkg/splunk/common/testdata/fixtures/get_cm_info_empty.json new file mode 100644 index 000000000..a8c1bccbf --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_cm_info_empty.json @@ -0,0 +1,16 @@ +{ + "links": {}, + "origin": "https://localhost:8089/services/cluster/master/info", + "updated": "2020-03-18T01:04:53+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/get_cm_peers.json b/pkg/splunk/common/testdata/fixtures/get_cm_peers.json new file mode 100644 index 000000000..febdc352a --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_cm_peers.json @@ -0,0 +1,113 @@ +{ + "links": { + "create": "/services/cluster/master/peers/_new" + }, + "origin": "https://localhost:8089/services/cluster/master/peers", + "updated": "2020-03-18T01:08:53+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [ + { + "name": "D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "id": "https://localhost:8089/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "list": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "edit": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "active_bundle_id": "14310A4AABD23E85BBD4559C4A3B59F8", + "apply_bundle_status": { + "invalid_bundle": { + "bundle_validation_errors": [], + "invalid_bundle_id": "" + }, + "reasons_for_restart": [], + "restart_required_for_apply_bundle": false, + "status": "None" + }, + "base_generation_id": 26, + "bucket_count": 73, + "bucket_count_by_index": { + "_audit": 24, + "_internal": 45, + "_telemetry": 4 + }, + "buckets_rf_by_origin_site": { + "default": 73 + }, + "buckets_sf_by_origin_site": { + "default": 73 + }, + "delayed_buckets_to_discard": [], + "eai:acl": null, + "fixup_set": [], + "heartbeat_started": true, + "host_port_pair": "10.36.0.6:8089", + "indexing_disk_space": 210707374080, + "is_searchable": true, + "is_valid_bundle": true, + "label": "splunk-s1-indexer-0", + "last_dry_run_bundle": "", + "last_heartbeat": 1584493732, + "last_validated_bundle": "14310A4AABD23E85BBD4559C4A3B59F8", + "latest_bundle_id": "14310A4AABD23E85BBD4559C4A3B59F8", + "peer_registered_summaries": true, + "pending_builds": [], + "pending_job_count": 0, + "primary_count": 73, + "primary_count_remote": 0, + "register_search_address": "10.36.0.6:8089", + "replication_count": 0, + "replication_port": 9887, + "replication_use_ssl": false, + "restart_required_for_applying_dry_run_bundle": false, + "search_state_counter": { + "PendingSearchable": 0, + "Searchable": 73, + "SearchablePendingMask": 0, + "Unsearchable": 0 + }, + "site": "default", + "splunk_version": "8.0.2", + "status": "Up", + "status_counter": { + "Complete": 69, + "NonStreamingTarget": 0, + "StreamingSource": 4, + "StreamingTarget": 0 + }, + "summary_replication_count": 0 + } + } + ], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set.json b/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set.json new file mode 100644 index 000000000..6b0ebfc2f --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set.json @@ -0,0 +1,269 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-cluster-master", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-cluster-master-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_cluster_master" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-cluster-master" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-cluster-master-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_apps.json b/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_apps.json new file mode 100644 index 000000000..cb5a40c7e --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_apps.json @@ -0,0 +1,273 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-cluster-master", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-cluster-master-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_cluster_master" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_LICENSE_URI", + "value": "/mnt/splunk.lic" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-cluster-master" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-cluster-master-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_extra_env.json b/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_extra_env.json new file mode 100644 index 000000000..35b1f74c0 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_extra_env.json @@ -0,0 +1,278 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-cluster-master", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-cluster-master-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_cluster_master" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_LICENSE_URI", + "value": "/mnt/splunk.lic" + }, + { + "name": "TEST_ENV_VAR", + "value": "test_value" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "serviceAccountName": "defaults", + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-cluster-master" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-cluster-master-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_license.json b/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_license.json new file mode 100644 index 000000000..f6660c6da --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_license.json @@ -0,0 +1,273 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-cluster-master", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-cluster-master-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_cluster_master" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_LICENSE_MASTER_URL", + "value": "splunk-stack1-license-master-service.test.svc.cluster.local" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-cluster-master" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-cluster-master-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_service_account.json b/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_service_account.json new file mode 100644 index 000000000..57b336352 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_service_account.json @@ -0,0 +1,274 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-cluster-master", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-cluster-master-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_cluster_master" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_LICENSE_URI", + "value": "/mnt/splunk.lic" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "serviceAccountName": "defaults", + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-cluster-master" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-cluster-master-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_url.json b/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_url.json new file mode 100644 index 000000000..57dffe776 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_cm_stateful_set_url.json @@ -0,0 +1,273 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-cluster-master", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-cluster-master-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_cluster_master" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_LICENSE_URI", + "value": "/mnt/splunk.lic" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-cluster-master" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-cluster-master", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-master", + "app.kubernetes.io/part-of": "splunk-stack1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-cluster-master-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_indexer_cluster_peer_info.json b/pkg/splunk/common/testdata/fixtures/get_indexer_cluster_peer_info.json new file mode 100644 index 000000000..ea0a62d09 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_indexer_cluster_peer_info.json @@ -0,0 +1,72 @@ +{ + "links": {}, + "origin": "https://localhost:8089/services/cluster/slave/info", + "updated": "2020-03-18T01:28:18+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [ + { + "name": "slave", + "id": "https://localhost:8089/services/cluster/slave/info/slave", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/slave/info/slave", + "list": "/services/cluster/slave/info/slave" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "active_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/87c8c24e7fabc3ff9683c26652cb5890-1583870244.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "timestamp": 1583870244 + }, + "base_generation_id": 26, + "eai:acl": null, + "is_registered": true, + "last_dry_run_bundle": { + "bundle_path": "", + "checksum": "", + "timestamp": 0 + }, + "last_heartbeat_attempt": 0, + "latest_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/87c8c24e7fabc3ff9683c26652cb5890-1583870244.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "timestamp": 1583870244 + }, + "maintenance_mode": false, + "registered_summary_state": 3, + "restart_state": "NoRestart", + "site": "default", + "status": "Up" + } + } + ], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/get_indexer_cluster_peer_info_empty.json b/pkg/splunk/common/testdata/fixtures/get_indexer_cluster_peer_info_empty.json new file mode 100644 index 000000000..436dc3a5e --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_indexer_cluster_peer_info_empty.json @@ -0,0 +1,16 @@ +{ + "links": {}, + "origin": "https://localhost:8089/services/cluster/slave/info", + "updated": "2020-03-18T01:28:18+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest0.json b/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest0.json new file mode 100644 index 000000000..1da6e2751 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest0.json @@ -0,0 +1,283 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-indexer", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-indexer-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_indexer" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-manager1-cluster-manager-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-indexer" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-indexer-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest1.json b/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest1.json new file mode 100644 index 000000000..1da6e2751 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest1.json @@ -0,0 +1,283 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-indexer", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-indexer-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_indexer" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-manager1-cluster-manager-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-indexer" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-indexer-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest2.json b/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest2.json new file mode 100644 index 000000000..f1a954a7c --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest2.json @@ -0,0 +1,288 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-indexer", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-indexer-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + }, + { + "name": "user-defined", + "containerPort": 32000, + "protocol": "UDP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_indexer" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-manager1-cluster-manager-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-indexer" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-indexer-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest3.json b/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest3.json new file mode 100644 index 000000000..f1a954a7c --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest3.json @@ -0,0 +1,288 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-indexer", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-indexer-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + }, + { + "name": "user-defined", + "containerPort": 32000, + "protocol": "UDP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_indexer" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-manager1-cluster-manager-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-indexer" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-indexer-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest4.json b/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest4.json new file mode 100644 index 000000000..2afc8a550 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest4.json @@ -0,0 +1,289 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-indexer", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-indexer-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + }, + { + "name": "user-defined", + "containerPort": 32000, + "protocol": "UDP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_indexer" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-manager1-cluster-manager-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "serviceAccountName": "defaults", + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-indexer" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-indexer-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest5.json b/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest5.json new file mode 100644 index 000000000..7f1d7e0f8 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_indexer_stateful_settest5.json @@ -0,0 +1,293 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-indexer", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-indexer-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + }, + { + "name": "user-defined", + "containerPort": 32000, + "protocol": "UDP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_indexer" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-manager1-cluster-manager-service" + }, + { + "name": "TEST_ENV_VAR", + "value": "test_value" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "serviceAccountName": "defaults", + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-indexer" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-stack1-indexer", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "indexer", + "app.kubernetes.io/part-of": "splunk-manager1-indexer" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-indexer-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t1.json b/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t1.json new file mode 100644 index 000000000..81c611c36 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t1.json @@ -0,0 +1,269 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-license-manager", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-license-manager-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_license_master" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-license-manager" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-license-manager-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t2.json b/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t2.json new file mode 100644 index 000000000..a4495e3c2 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t2.json @@ -0,0 +1,273 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-license-manager", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-license-manager-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_license_master" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_LICENSE_URI", + "value": "/mnt/splunk.lic" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-license-manager" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-license-manager-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t3.json b/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t3.json new file mode 100644 index 000000000..e44f34b80 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t3.json @@ -0,0 +1,273 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-license-manager", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-license-manager-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_license_master" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_LICENSE_URI", + "value": "/mnt/splunk.lic" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-license-manager" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-license-manager-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t4.json b/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t4.json new file mode 100644 index 000000000..5d026360d --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t4.json @@ -0,0 +1,274 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-license-manager", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-license-manager-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_license_master" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_LICENSE_URI", + "value": "/mnt/splunk.lic" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "serviceAccountName": "defaults", + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-license-manager" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-license-manager-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t5.json b/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t5.json new file mode 100644 index 000000000..131805533 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_lm_stateful_set_t5.json @@ -0,0 +1,278 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-license-manager", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-license-manager-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_license_master" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_LICENSE_URI", + "value": "/mnt/splunk.lic" + }, + { + "name": "TEST_ENV_VAR", + "value": "test_value" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "serviceAccountName": "defaults", + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-license-manager" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "license-manager", + "app.kubernetes.io/instance": "splunk-stack1-license-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "license-manager", + "app.kubernetes.io/part-of": "splunk-stack1-license-manager" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-license-manager-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_mc_asset_table.json b/pkg/splunk/common/testdata/fixtures/get_mc_asset_table.json new file mode 100644 index 000000000..1abfb0d86 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_mc_asset_table.json @@ -0,0 +1,122 @@ +{ + "links": { + "create": "/services/search/distributed/peers/_new", + "_reload": "/services/search/distributed/peers/_reload" + }, + "origin": "https://localhost:8089/services/search/distributed/peers", + "updated": "2020-09-22T21:43:33+00:00", + "generator": { + "build": "a1a6394cc5ae", + "version": "8.0.5" + }, + "entry": [ + { + "name": "splunk-example-cluster-master-service:8089", + "id": "https://localhost:8089/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089", + "list": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089", + "_reload": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089/_reload", + "edit": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089", + "remove": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089", + "disable": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089/disable", + "quarantine": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089/quarantine" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "build": "a1a6394cc5ae", + "bundle_isIndexing": [ + "15065687072217053252 - false", + "16923722576385601869 - false", + "8527338655074501134 - false", + "5466829646820181037 - false", + "12887664000706842849 - false" + ], + "bundle_versions": [ + "15065687072217053252", + "16923722576385601869", + "8527338655074501134", + "5466829646820181037", + "12887664000706842849" + ], + "cluster_label": [ + "idxc_label" + ], + "cpu_arch": "x86_64", + "disabled": false, + "eai:acl": null, + "enableRFSMonitoring": false, + "guid": "19F5CA13-A561-4D1B-9341-A7BFC3E92F06", + "host": "splunk-example-cluster-master-0", + "host_fqdn": "splunk-example-cluster-master-0", + "isForwarding": true, + "is_https": true, + "licenseSignature": "c2bf3f573bbaf36ae13f326762945905", + "numberOfCores": "1", + "numberOfVirtualCores": "2", + "os_build": "#1 SMP Thu Sep 3 19:04:44 UTC 2020", + "os_name": "Linux", + "os_version": "4.14.193-149.317.amzn2.x86_64", + "peerName": "splunk-example-cluster-master-0", + "peerType": "configured", + "physicalMemoryMB": "7764", + "remote_session": "2bOC3nPGg_s2UREElAhLcKFXxuMNgwasCQPJG^tlXJ5LMzX1aCC8zwgWN2dCtUD2TyQ1szY0sdQhOwJyK_Igj6JUfEmcVGrsd3BtBvFOb0R_6F9kYRzHKz3", + "replicationStatus": "Successful", + "rtsearch_enabled": true, + "search_groups": [ + "dmc_group_cluster_master", + "dmc_group_license_master", + "dmc_indexerclustergroup_idxc_label" + ], + "searchable_indexes": [ + "_audit", + "_internal", + "_introspection", + "_metrics", + "_metrics_rollup", + "_telemetry", + "_thefishbucket", + "history", + "main", + "summary" + ], + "server_roles": [ + "license_master", + "cluster_master", + "search_head" + ], + "shcluster_label": "", + "startup_time": 1600810341, + "status": "Up", + "status_details": [], + "version": "8.0.5" + } + } + ], + "paging": { + "total": 4, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set.json b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set.json new file mode 100644 index 000000000..287fa9988 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set.json @@ -0,0 +1,221 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-test-monitoring-console", + "namespace": "test", + "creationTimestamp": null + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-test-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-test-monitoring-console" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-test-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-test-monitoring-console" + }, + "annotations": { + "monitoringConsoleConfigRev": "", + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "mnt-splunk-etc", + "emptyDir": {} + }, + { + "name": "mnt-splunk-var", + "emptyDir": {} + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-test-secret", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "splunk-test-monitoring-console" + } + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_monitor" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack1-cluster-master-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "mnt-splunk-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "mnt-splunk-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 300, + "timeoutSeconds": 30, + "periodSeconds": 30 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 16 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-test-monitoring-console" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "serviceName": "splunk-test-monitoring-console-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "availableReplicas": 0, + "replicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t1.json b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t1.json new file mode 100644 index 000000000..605733c43 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t1.json @@ -0,0 +1,287 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-monitoring-console", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + }, + "annotations": { + "monitoringConsoleConfigRev": "", + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-monitoring-console-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "splunk-stack1-monitoring-console" + } + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_monitor" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-monitoring-console" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-monitoring-console-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t2.json b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t2.json new file mode 100644 index 000000000..3c4a5d707 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t2.json @@ -0,0 +1,243 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-monitoring-console", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + }, + "annotations": { + "monitoringConsoleConfigRev": "", + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "mnt-splunk-etc", + "emptyDir": {} + }, + { + "name": "mnt-splunk-var", + "emptyDir": {} + }, + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-monitoring-console-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "splunk-stack1-monitoring-console" + } + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_monitor" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "mnt-splunk-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "mnt-splunk-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-monitoring-console" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "serviceName": "splunk-stack1-monitoring-console-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t3.json b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t3.json new file mode 100644 index 000000000..eb2ce373d --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t3.json @@ -0,0 +1,311 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-monitoring-console", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + }, + "annotations": { + "monitoringConsoleConfigRev": "", + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "defaults" + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-monitoring-console-secret-v1", + "defaultMode": 420 + } + }, + { + "name": "mnt-splunk-defaults", + "configMap": { + "name": "splunk-stack1-monitoring-console-defaults", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "splunk-stack1-monitoring-console" + } + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_monitor" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack2-cluster-manager-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "defaults", + "mountPath": "/mnt/defaults" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + }, + { + "name": "mnt-splunk-defaults", + "mountPath": "/mnt/splunk-defaults" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-monitoring-console" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "custom-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-monitoring-console-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t4.json b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t4.json new file mode 100644 index 000000000..b71fb04c6 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t4.json @@ -0,0 +1,311 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-monitoring-console", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + }, + "annotations": { + "monitoringConsoleConfigRev": "", + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "defaults" + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-monitoring-console-secret-v1", + "defaultMode": 420 + } + }, + { + "name": "mnt-splunk-defaults", + "configMap": { + "name": "splunk-stack1-monitoring-console-defaults", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "splunk-stack1-monitoring-console" + } + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_monitor" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack2-cluster-manager-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "defaults", + "mountPath": "/mnt/defaults" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + }, + { + "name": "mnt-splunk-defaults", + "mountPath": "/mnt/splunk-defaults" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-monitoring-console" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "custom-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-monitoring-console-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t5.json b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t5.json new file mode 100644 index 000000000..8a3c5398e --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t5.json @@ -0,0 +1,312 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-monitoring-console", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + }, + "annotations": { + "monitoringConsoleConfigRev": "", + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "defaults" + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-monitoring-console-secret-v1", + "defaultMode": 420 + } + }, + { + "name": "mnt-splunk-defaults", + "configMap": { + "name": "splunk-stack1-monitoring-console-defaults", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "splunk-stack1-monitoring-console" + } + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_monitor" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack2-cluster-manager-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "defaults", + "mountPath": "/mnt/defaults" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + }, + { + "name": "mnt-splunk-defaults", + "mountPath": "/mnt/splunk-defaults" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "serviceAccountName": "defaults", + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-monitoring-console" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "custom-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-monitoring-console-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t6.json b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t6.json new file mode 100644 index 000000000..fd0201211 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_monitoring_console_stateful_set_t6.json @@ -0,0 +1,316 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-monitoring-console", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + }, + "annotations": { + "monitoringConsoleConfigRev": "", + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "defaults" + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-monitoring-console-secret-v1", + "defaultMode": 420 + } + }, + { + "name": "mnt-splunk-defaults", + "configMap": { + "name": "splunk-stack1-monitoring-console-defaults", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "envFrom": [ + { + "configMapRef": { + "name": "splunk-stack1-monitoring-console" + } + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_monitor" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack2-cluster-manager-service" + }, + { + "name": "TEST_ENV_VAR", + "value": "test_value" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "defaults", + "mountPath": "/mnt/defaults" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + }, + { + "name": "mnt-splunk-defaults", + "mountPath": "/mnt/splunk-defaults" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "serviceAccountName": "defaults", + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-monitoring-console" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "custom-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "monitoring-console", + "app.kubernetes.io/instance": "splunk-stack1-monitoring-console", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "monitoring-console", + "app.kubernetes.io/part-of": "splunk-stack1-monitoring-console" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-monitoring-console-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set.json b/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set.json new file mode 100644 index 000000000..59faeebc3 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set.json @@ -0,0 +1,291 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-search-head", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + }, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 5, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-search-head-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_search_head" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_SEARCH_HEAD_URL", + "value": "splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-1.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-2.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-3.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-4.splunk-stack1-search-head-headless.test.svc.cluster.local" + }, + { + "name": "SPLUNK_SEARCH_HEAD_CAPTAIN_URL", + "value": "splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local" + }, + { + "name": "SPLUNK_DEPLOYER_URL", + "value": "splunk-stack1-deployer-service" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack1-cluster-master-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812 + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-search-head" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-search-head-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_apps.json b/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_apps.json new file mode 100644 index 000000000..4c798a6b3 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_apps.json @@ -0,0 +1,285 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-search-head", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 6, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-search-head-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_search_head" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_SEARCH_HEAD_URL", + "value": "splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-1.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-2.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-3.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-4.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-5.splunk-stack1-search-head-headless.test.svc.cluster.local" + }, + { + "name": "SPLUNK_SEARCH_HEAD_CAPTAIN_URL", + "value": "splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local" + }, + { + "name": "SPLUNK_DEPLOYER_URL", + "value": "splunk-stack1-deployer-service" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack1-cluster-master-service.test2.svc.cluster.local" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-search-head" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-search-head-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_new_port.json b/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_new_port.json new file mode 100644 index 000000000..4c798a6b3 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_new_port.json @@ -0,0 +1,285 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-search-head", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 6, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-search-head-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_search_head" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_SEARCH_HEAD_URL", + "value": "splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-1.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-2.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-3.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-4.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-5.splunk-stack1-search-head-headless.test.svc.cluster.local" + }, + { + "name": "SPLUNK_SEARCH_HEAD_CAPTAIN_URL", + "value": "splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local" + }, + { + "name": "SPLUNK_DEPLOYER_URL", + "value": "splunk-stack1-deployer-service" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack1-cluster-master-service.test2.svc.cluster.local" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-search-head" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-search-head-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_t2.json b/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_t2.json new file mode 100644 index 000000000..4c798a6b3 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_t2.json @@ -0,0 +1,285 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-search-head", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 6, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-search-head-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_search_head" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_SEARCH_HEAD_URL", + "value": "splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-1.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-2.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-3.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-4.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-5.splunk-stack1-search-head-headless.test.svc.cluster.local" + }, + { + "name": "SPLUNK_SEARCH_HEAD_CAPTAIN_URL", + "value": "splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local" + }, + { + "name": "SPLUNK_DEPLOYER_URL", + "value": "splunk-stack1-deployer-service" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack1-cluster-master-service.test2.svc.cluster.local" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-search-head" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-search-head-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_t3.json b/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_t3.json new file mode 100644 index 000000000..f6f3cb71a --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_t3.json @@ -0,0 +1,286 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-search-head", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 6, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-search-head-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_search_head" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_SEARCH_HEAD_URL", + "value": "splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-1.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-2.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-3.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-4.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-5.splunk-stack1-search-head-headless.test.svc.cluster.local" + }, + { + "name": "SPLUNK_SEARCH_HEAD_CAPTAIN_URL", + "value": "splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local" + }, + { + "name": "SPLUNK_DEPLOYER_URL", + "value": "splunk-stack1-deployer-service" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack1-cluster-master-service.test2.svc.cluster.local" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "serviceAccountName": "defaults", + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-search-head" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-search-head-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_t4.json b/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_t4.json new file mode 100644 index 000000000..ad40db4d9 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_search_head_stateful_set_t4.json @@ -0,0 +1,290 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-search-head", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 6, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-search-head-secret-v1", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_search_head" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_SEARCH_HEAD_URL", + "value": "splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-1.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-2.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-3.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-4.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-5.splunk-stack1-search-head-headless.test.svc.cluster.local" + }, + { + "name": "SPLUNK_SEARCH_HEAD_CAPTAIN_URL", + "value": "splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local" + }, + { + "name": "SPLUNK_DEPLOYER_URL", + "value": "splunk-stack1-deployer-service" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack1-cluster-master-service.test2.svc.cluster.local" + }, + { + "name": "TEST_ENV_VAR", + "value": "test_value" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "serviceAccountName": "defaults", + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-search-head" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "default-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "search-head", + "app.kubernetes.io/instance": "splunk-stack1-search-head", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "search-head", + "app.kubernetes.io/part-of": "splunk-stack1-search-head" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-search-head-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_standalone_stateful_set_t1.json b/pkg/splunk/common/testdata/fixtures/get_standalone_stateful_set_t1.json new file mode 100644 index 000000000..bffee5be6 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_standalone_stateful_set_t1.json @@ -0,0 +1,309 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-standalone", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + }, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "defaults" + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-standalone-secret-v1", + "defaultMode": 420 + } + }, + { + "name": "mnt-splunk-defaults", + "configMap": { + "name": "splunk-stack1-standalone-defaults", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_search_head" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack2-cluster-manager-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "defaults", + "mountPath": "/mnt/defaults" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + }, + { + "name": "mnt-splunk-defaults", + "mountPath": "/mnt/splunk-defaults" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812 + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-standalone" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "custom-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-standalone-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_standalone_stateful_set_t2.json b/pkg/splunk/common/testdata/fixtures/get_standalone_stateful_set_t2.json new file mode 100644 index 000000000..00e50d5ec --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_standalone_stateful_set_t2.json @@ -0,0 +1,303 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-standalone", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "defaults" + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-standalone-secret-v1", + "defaultMode": 420 + } + }, + { + "name": "mnt-splunk-defaults", + "configMap": { + "name": "splunk-stack1-standalone-defaults", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_search_head" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack2-cluster-manager-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "defaults", + "mountPath": "/mnt/defaults" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + }, + { + "name": "mnt-splunk-defaults", + "mountPath": "/mnt/splunk-defaults" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-standalone" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "custom-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-standalone-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_standalone_stateful_set_t3.json b/pkg/splunk/common/testdata/fixtures/get_standalone_stateful_set_t3.json new file mode 100644 index 000000000..86876fa50 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_standalone_stateful_set_t3.json @@ -0,0 +1,304 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-standalone", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "defaults" + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-standalone-secret-v1", + "defaultMode": 420 + } + }, + { + "name": "mnt-splunk-defaults", + "configMap": { + "name": "splunk-stack1-standalone-defaults", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_search_head" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack2-cluster-manager-service" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "defaults", + "mountPath": "/mnt/defaults" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + }, + { + "name": "mnt-splunk-defaults", + "mountPath": "/mnt/splunk-defaults" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "serviceAccountName": "defaults", + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-standalone" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "custom-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-standalone-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/get_standalone_stateful_set_t4.json b/pkg/splunk/common/testdata/fixtures/get_standalone_stateful_set_t4.json new file mode 100644 index 000000000..ff10f6f15 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/get_standalone_stateful_set_t4.json @@ -0,0 +1,308 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "splunk-stack1-standalone", + "namespace": "test", + "creationTimestamp": null, + "ownerReferences": [ + { + "apiVersion": "", + "kind": "", + "name": "stack1", + "uid": "", + "controller": true + } + ] + }, + "spec": { + "replicas": 1, + "selector": { + "matchLabels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + } + }, + "template": { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + }, + "annotations": { + "traffic.sidecar.istio.io/excludeOutboundPorts": "8089,8191,9997", + "traffic.sidecar.istio.io/includeInboundPorts": "8000,8088" + } + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + }, + { + "name": "defaults" + }, + { + "name": "mnt-splunk-secrets", + "secret": { + "secretName": "splunk-stack1-standalone-secret-v1", + "defaultMode": 420 + } + }, + { + "name": "mnt-splunk-defaults", + "configMap": { + "name": "splunk-stack1-standalone-defaults", + "defaultMode": 420 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "splunk/splunk", + "ports": [ + { + "name": "http-splunkweb", + "containerPort": 8000, + "protocol": "TCP" + }, + { + "name": "http-hec", + "containerPort": 8088, + "protocol": "TCP" + }, + { + "name": "https-splunkd", + "containerPort": 8089, + "protocol": "TCP" + }, + { + "name": "tcp-s2s", + "containerPort": 9997, + "protocol": "TCP" + } + ], + "env": [ + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "localhost" + }, + { + "name": "SPLUNK_HOME", + "value": "/opt/splunk" + }, + { + "name": "SPLUNK_START_ARGS", + "value": "--accept-license" + }, + { + "name": "SPLUNK_DEFAULTS_URL", + "value": "/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml" + }, + { + "name": "SPLUNK_HOME_OWNERSHIP_ENFORCEMENT", + "value": "false" + }, + { + "name": "SPLUNK_ROLE", + "value": "splunk_search_head" + }, + { + "name": "SPLUNK_DECLARATIVE_ADMIN_PASSWORD", + "value": "true" + }, + { + "name": "SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH", + "value": "/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh" + }, + { + "name": "SPLUNK_CLUSTER_MASTER_URL", + "value": "splunk-stack2-cluster-manager-service" + }, + { + "name": "TEST_ENV_VAR", + "value": "test_value" + } + ], + "resources": { + "limits": { + "cpu": "4", + "memory": "8Gi" + }, + "requests": { + "cpu": "100m", + "memory": "512Mi" + } + }, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + }, + { + "name": "defaults", + "mountPath": "/mnt/defaults" + }, + { + "name": "mnt-splunk-secrets", + "mountPath": "/mnt/splunk-secrets" + }, + { + "name": "mnt-splunk-defaults", + "mountPath": "/mnt/splunk-defaults" + } + ], + "livenessProbe": { + "exec": { + "command": [ + "/mnt/probes/livenessProbe.sh" + ] + }, + "initialDelaySeconds": 30, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 3 + }, + "readinessProbe": { + "exec": { + "command": [ + "/mnt/probes/readinessProbe.sh" + ] + }, + "initialDelaySeconds": 10, + "timeoutSeconds": 5, + "periodSeconds": 5, + "failureThreshold": 3 + }, + "startupProbe": { + "exec": { + "command": [ + "/mnt/probes/startupProbe.sh" + ] + }, + "initialDelaySeconds": 40, + "timeoutSeconds": 30, + "periodSeconds": 30, + "failureThreshold": 12 + }, + "imagePullPolicy": "IfNotPresent" + } + ], + "serviceAccountName": "defaults", + "securityContext": { + "runAsUser": 41812, + "runAsNonRoot": true, + "fsGroup": 41812, + "fsGroupChangePolicy": "OnRootMismatch" + }, + "affinity": { + "podAntiAffinity": { + "preferredDuringSchedulingIgnoredDuringExecution": [ + { + "weight": 100, + "podAffinityTerm": { + "labelSelector": { + "matchExpressions": [ + { + "key": "app.kubernetes.io/instance", + "operator": "In", + "values": [ + "splunk-stack1-standalone" + ] + } + ] + }, + "topologyKey": "kubernetes.io/hostname" + } + } + ] + } + }, + "schedulerName": "custom-scheduler" + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "standalone", + "app.kubernetes.io/instance": "splunk-stack1-standalone", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "standalone", + "app.kubernetes.io/part-of": "splunk-stack1-standalone" + } + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + } + ], + "serviceName": "splunk-stack1-standalone-headless", + "podManagementPolicy": "Parallel", + "updateStrategy": { + "type": "OnDelete" + } + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/common/testdata/fixtures/indexer_cluster_pod_manager_info.json b/pkg/splunk/common/testdata/fixtures/indexer_cluster_pod_manager_info.json new file mode 100644 index 000000000..262728f4b --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/indexer_cluster_pod_manager_info.json @@ -0,0 +1,100 @@ +{ + "links": {}, + "origin": "https://localhost:8089/services/cluster/master/info", + "updated": "2020-03-18T01:04:53+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [ + { + "name": "master", + "id": "https://localhost:8089/services/cluster/master/info/master", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/master/info/master", + "list": "/services/cluster/master/info/master" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "active_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "timestamp": 1583870198 + }, + "apply_bundle_status": { + "invalid_bundle": { + "bundle_path": "", + "bundle_validation_errors_on_master": [], + "checksum": "", + "timestamp": 0 + }, + "reload_bundle_issued": false, + "status": "None" + }, + "backup_and_restore_primaries": false, + "controlled_rolling_restart_flag": false, + "eai:acl": null, + "indexing_ready_flag": true, + "initialized_flag": true, + "label": "splunk-stack1-cluster-master-0", + "last_check_restart_bundle_result": false, + "last_dry_run_bundle": { + "bundle_path": "", + "checksum": "", + "timestamp": 0 + }, + "last_validated_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/0af7c0e95f313f7be3b0cb1d878df9a1-1583948640.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "is_valid_bundle": true, + "timestamp": 1583948640 + }, + "latest_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "timestamp": 1583870198 + }, + "maintenance_mode": false, + "multisite": false, + "previous_active_bundle": { + "bundle_path": "", + "checksum": "", + "timestamp": 0 + }, + "primaries_backup_status": "No on-going (or) completed primaries backup yet. Check back again in few minutes if you expect a backup.", + "quiet_period_flag": false, + "rolling_restart_flag": false, + "rolling_restart_or_upgrade": false, + "service_ready_flag": true, + "start_time": 1583948636, + "summary_replication": "false" + } + } + ], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/indexer_cluster_pod_manager_peer.json b/pkg/splunk/common/testdata/fixtures/indexer_cluster_pod_manager_peer.json new file mode 100644 index 000000000..74bec62b0 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/indexer_cluster_pod_manager_peer.json @@ -0,0 +1,113 @@ +{ + "links": { + "create": "/services/cluster/master/peers/_new" + }, + "origin": "https://localhost:8089/services/cluster/master/peers", + "updated": "2020-03-18T01:08:53+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [ + { + "name": "D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "id": "https://localhost:8089/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "list": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "edit": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "active_bundle_id": "14310A4AABD23E85BBD4559C4A3B59F8", + "apply_bundle_status": { + "invalid_bundle": { + "bundle_validation_errors": [], + "invalid_bundle_id": "" + }, + "reasons_for_restart": [], + "restart_required_for_apply_bundle": false, + "status": "None" + }, + "base_generation_id": 26, + "bucket_count": 73, + "bucket_count_by_index": { + "_audit": 24, + "_internal": 45, + "_telemetry": 4 + }, + "buckets_rf_by_origin_site": { + "default": 73 + }, + "buckets_sf_by_origin_site": { + "default": 73 + }, + "delayed_buckets_to_discard": [], + "eai:acl": null, + "fixup_set": [], + "heartbeat_started": true, + "host_port_pair": "10.36.0.6:8089", + "indexing_disk_space": 210707374080, + "is_searchable": true, + "is_valid_bundle": true, + "label": "splunk-stack1-indexer-0", + "last_dry_run_bundle": "", + "last_heartbeat": 1584493732, + "last_validated_bundle": "14310A4AABD23E85BBD4559C4A3B59F8", + "latest_bundle_id": "14310A4AABD23E85BBD4559C4A3B59F8", + "peer_registered_summaries": true, + "pending_builds": [], + "pending_job_count": 0, + "primary_count": 73, + "primary_count_remote": 0, + "register_search_address": "10.36.0.6:8089", + "replication_count": 0, + "replication_port": 9887, + "replication_use_ssl": false, + "restart_required_for_applying_dry_run_bundle": false, + "search_state_counter": { + "PendingSearchable": 0, + "Searchable": 73, + "SearchablePendingMask": 0, + "Unsearchable": 0 + }, + "site": "default", + "splunk_version": "8.0.2", + "status": "Up", + "status_counter": { + "Complete": 69, + "NonStreamingTarget": 0, + "StreamingSource": 4, + "StreamingTarget": 0 + }, + "summary_replication_count": 0 + } + } + ], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/invalid_peer_in_finish_recycle_info.json b/pkg/splunk/common/testdata/fixtures/invalid_peer_in_finish_recycle_info.json new file mode 100644 index 000000000..262728f4b --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/invalid_peer_in_finish_recycle_info.json @@ -0,0 +1,100 @@ +{ + "links": {}, + "origin": "https://localhost:8089/services/cluster/master/info", + "updated": "2020-03-18T01:04:53+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [ + { + "name": "master", + "id": "https://localhost:8089/services/cluster/master/info/master", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/master/info/master", + "list": "/services/cluster/master/info/master" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "active_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "timestamp": 1583870198 + }, + "apply_bundle_status": { + "invalid_bundle": { + "bundle_path": "", + "bundle_validation_errors_on_master": [], + "checksum": "", + "timestamp": 0 + }, + "reload_bundle_issued": false, + "status": "None" + }, + "backup_and_restore_primaries": false, + "controlled_rolling_restart_flag": false, + "eai:acl": null, + "indexing_ready_flag": true, + "initialized_flag": true, + "label": "splunk-stack1-cluster-master-0", + "last_check_restart_bundle_result": false, + "last_dry_run_bundle": { + "bundle_path": "", + "checksum": "", + "timestamp": 0 + }, + "last_validated_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/0af7c0e95f313f7be3b0cb1d878df9a1-1583948640.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "is_valid_bundle": true, + "timestamp": 1583948640 + }, + "latest_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "timestamp": 1583870198 + }, + "maintenance_mode": false, + "multisite": false, + "previous_active_bundle": { + "bundle_path": "", + "checksum": "", + "timestamp": 0 + }, + "primaries_backup_status": "No on-going (or) completed primaries backup yet. Check back again in few minutes if you expect a backup.", + "quiet_period_flag": false, + "rolling_restart_flag": false, + "rolling_restart_or_upgrade": false, + "service_ready_flag": true, + "start_time": 1583948636, + "summary_replication": "false" + } + } + ], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/invalid_peer_in_finish_recycle_peer.json b/pkg/splunk/common/testdata/fixtures/invalid_peer_in_finish_recycle_peer.json new file mode 100644 index 000000000..74bec62b0 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/invalid_peer_in_finish_recycle_peer.json @@ -0,0 +1,113 @@ +{ + "links": { + "create": "/services/cluster/master/peers/_new" + }, + "origin": "https://localhost:8089/services/cluster/master/peers", + "updated": "2020-03-18T01:08:53+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [ + { + "name": "D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "id": "https://localhost:8089/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "list": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "edit": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "active_bundle_id": "14310A4AABD23E85BBD4559C4A3B59F8", + "apply_bundle_status": { + "invalid_bundle": { + "bundle_validation_errors": [], + "invalid_bundle_id": "" + }, + "reasons_for_restart": [], + "restart_required_for_apply_bundle": false, + "status": "None" + }, + "base_generation_id": 26, + "bucket_count": 73, + "bucket_count_by_index": { + "_audit": 24, + "_internal": 45, + "_telemetry": 4 + }, + "buckets_rf_by_origin_site": { + "default": 73 + }, + "buckets_sf_by_origin_site": { + "default": 73 + }, + "delayed_buckets_to_discard": [], + "eai:acl": null, + "fixup_set": [], + "heartbeat_started": true, + "host_port_pair": "10.36.0.6:8089", + "indexing_disk_space": 210707374080, + "is_searchable": true, + "is_valid_bundle": true, + "label": "splunk-stack1-indexer-0", + "last_dry_run_bundle": "", + "last_heartbeat": 1584493732, + "last_validated_bundle": "14310A4AABD23E85BBD4559C4A3B59F8", + "latest_bundle_id": "14310A4AABD23E85BBD4559C4A3B59F8", + "peer_registered_summaries": true, + "pending_builds": [], + "pending_job_count": 0, + "primary_count": 73, + "primary_count_remote": 0, + "register_search_address": "10.36.0.6:8089", + "replication_count": 0, + "replication_port": 9887, + "replication_use_ssl": false, + "restart_required_for_applying_dry_run_bundle": false, + "search_state_counter": { + "PendingSearchable": 0, + "Searchable": 73, + "SearchablePendingMask": 0, + "Unsearchable": 0 + }, + "site": "default", + "splunk_version": "8.0.2", + "status": "Up", + "status_counter": { + "Complete": 69, + "NonStreamingTarget": 0, + "StreamingSource": 4, + "StreamingTarget": 0 + }, + "summary_replication_count": 0 + } + } + ], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/invalid_peer_status_in_scale_down_info.json b/pkg/splunk/common/testdata/fixtures/invalid_peer_status_in_scale_down_info.json new file mode 100644 index 000000000..262728f4b --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/invalid_peer_status_in_scale_down_info.json @@ -0,0 +1,100 @@ +{ + "links": {}, + "origin": "https://localhost:8089/services/cluster/master/info", + "updated": "2020-03-18T01:04:53+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [ + { + "name": "master", + "id": "https://localhost:8089/services/cluster/master/info/master", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/master/info/master", + "list": "/services/cluster/master/info/master" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "active_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "timestamp": 1583870198 + }, + "apply_bundle_status": { + "invalid_bundle": { + "bundle_path": "", + "bundle_validation_errors_on_master": [], + "checksum": "", + "timestamp": 0 + }, + "reload_bundle_issued": false, + "status": "None" + }, + "backup_and_restore_primaries": false, + "controlled_rolling_restart_flag": false, + "eai:acl": null, + "indexing_ready_flag": true, + "initialized_flag": true, + "label": "splunk-stack1-cluster-master-0", + "last_check_restart_bundle_result": false, + "last_dry_run_bundle": { + "bundle_path": "", + "checksum": "", + "timestamp": 0 + }, + "last_validated_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/0af7c0e95f313f7be3b0cb1d878df9a1-1583948640.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "is_valid_bundle": true, + "timestamp": 1583948640 + }, + "latest_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "timestamp": 1583870198 + }, + "maintenance_mode": false, + "multisite": false, + "previous_active_bundle": { + "bundle_path": "", + "checksum": "", + "timestamp": 0 + }, + "primaries_backup_status": "No on-going (or) completed primaries backup yet. Check back again in few minutes if you expect a backup.", + "quiet_period_flag": false, + "rolling_restart_flag": false, + "rolling_restart_or_upgrade": false, + "service_ready_flag": true, + "start_time": 1583948636, + "summary_replication": "false" + } + } + ], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/invalid_peer_status_in_scale_down_peer.json b/pkg/splunk/common/testdata/fixtures/invalid_peer_status_in_scale_down_peer.json new file mode 100644 index 000000000..d2bc78e43 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/invalid_peer_status_in_scale_down_peer.json @@ -0,0 +1,113 @@ +{ + "links": { + "create": "/services/cluster/master/peers/_new" + }, + "origin": "https://localhost:8089/services/cluster/master/peers", + "updated": "2020-03-18T01:08:53+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [ + { + "name": "D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "id": "https://localhost:8089/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "list": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "edit": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "active_bundle_id": "14310A4AABD23E85BBD4559C4A3B59F8", + "apply_bundle_status": { + "invalid_bundle": { + "bundle_validation_errors": [], + "invalid_bundle_id": "" + }, + "reasons_for_restart": [], + "restart_required_for_apply_bundle": false, + "status": "None" + }, + "base_generation_id": 26, + "bucket_count": 73, + "bucket_count_by_index": { + "_audit": 24, + "_internal": 45, + "_telemetry": 4 + }, + "buckets_rf_by_origin_site": { + "default": 73 + }, + "buckets_sf_by_origin_site": { + "default": 73 + }, + "delayed_buckets_to_discard": [], + "eai:acl": null, + "fixup_set": [], + "heartbeat_started": true, + "host_port_pair": "10.36.0.6:8089", + "indexing_disk_space": 210707374080, + "is_searchable": true, + "is_valid_bundle": true, + "label": "splunk-stack1-indexer-0", + "last_dry_run_bundle": "", + "last_heartbeat": 1584493732, + "last_validated_bundle": "14310A4AABD23E85BBD4559C4A3B59F8", + "latest_bundle_id": "14310A4AABD23E85BBD4559C4A3B59F8", + "peer_registered_summaries": true, + "pending_builds": [], + "pending_job_count": 0, + "primary_count": 73, + "primary_count_remote": 0, + "register_search_address": "10.36.0.6:8089", + "replication_count": 0, + "replication_port": 9887, + "replication_use_ssl": false, + "restart_required_for_applying_dry_run_bundle": false, + "search_state_counter": { + "PendingSearchable": 0, + "Searchable": 73, + "SearchablePendingMask": 0, + "Unsearchable": 0 + }, + "site": "default", + "splunk_version": "8.0.2", + "status": "Invalid_Status", + "status_counter": { + "Complete": 69, + "NonStreamingTarget": 0, + "StreamingSource": 4, + "StreamingTarget": 0 + }, + "summary_replication_count": 0 + } + } + ], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/mc_apply_changes.json b/pkg/splunk/common/testdata/fixtures/mc_apply_changes.json new file mode 100644 index 000000000..1abfb0d86 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/mc_apply_changes.json @@ -0,0 +1,122 @@ +{ + "links": { + "create": "/services/search/distributed/peers/_new", + "_reload": "/services/search/distributed/peers/_reload" + }, + "origin": "https://localhost:8089/services/search/distributed/peers", + "updated": "2020-09-22T21:43:33+00:00", + "generator": { + "build": "a1a6394cc5ae", + "version": "8.0.5" + }, + "entry": [ + { + "name": "splunk-example-cluster-master-service:8089", + "id": "https://localhost:8089/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089", + "list": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089", + "_reload": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089/_reload", + "edit": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089", + "remove": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089", + "disable": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089/disable", + "quarantine": "/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089/quarantine" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "build": "a1a6394cc5ae", + "bundle_isIndexing": [ + "15065687072217053252 - false", + "16923722576385601869 - false", + "8527338655074501134 - false", + "5466829646820181037 - false", + "12887664000706842849 - false" + ], + "bundle_versions": [ + "15065687072217053252", + "16923722576385601869", + "8527338655074501134", + "5466829646820181037", + "12887664000706842849" + ], + "cluster_label": [ + "idxc_label" + ], + "cpu_arch": "x86_64", + "disabled": false, + "eai:acl": null, + "enableRFSMonitoring": false, + "guid": "19F5CA13-A561-4D1B-9341-A7BFC3E92F06", + "host": "splunk-example-cluster-master-0", + "host_fqdn": "splunk-example-cluster-master-0", + "isForwarding": true, + "is_https": true, + "licenseSignature": "c2bf3f573bbaf36ae13f326762945905", + "numberOfCores": "1", + "numberOfVirtualCores": "2", + "os_build": "#1 SMP Thu Sep 3 19:04:44 UTC 2020", + "os_name": "Linux", + "os_version": "4.14.193-149.317.amzn2.x86_64", + "peerName": "splunk-example-cluster-master-0", + "peerType": "configured", + "physicalMemoryMB": "7764", + "remote_session": "2bOC3nPGg_s2UREElAhLcKFXxuMNgwasCQPJG^tlXJ5LMzX1aCC8zwgWN2dCtUD2TyQ1szY0sdQhOwJyK_Igj6JUfEmcVGrsd3BtBvFOb0R_6F9kYRzHKz3", + "replicationStatus": "Successful", + "rtsearch_enabled": true, + "search_groups": [ + "dmc_group_cluster_master", + "dmc_group_license_master", + "dmc_indexerclustergroup_idxc_label" + ], + "searchable_indexes": [ + "_audit", + "_internal", + "_introspection", + "_metrics", + "_metrics_rollup", + "_telemetry", + "_thefishbucket", + "history", + "main", + "summary" + ], + "server_roles": [ + "license_master", + "cluster_master", + "search_head" + ], + "shcluster_label": "", + "startup_time": 1600810341, + "status": "Up", + "status_details": [], + "version": "8.0.5" + } + } + ], + "paging": { + "total": 4, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/update_status_invalid_response0.json b/pkg/splunk/common/testdata/fixtures/update_status_invalid_response0.json new file mode 100644 index 000000000..262728f4b --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/update_status_invalid_response0.json @@ -0,0 +1,100 @@ +{ + "links": {}, + "origin": "https://localhost:8089/services/cluster/master/info", + "updated": "2020-03-18T01:04:53+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [ + { + "name": "master", + "id": "https://localhost:8089/services/cluster/master/info/master", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/master/info/master", + "list": "/services/cluster/master/info/master" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "active_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "timestamp": 1583870198 + }, + "apply_bundle_status": { + "invalid_bundle": { + "bundle_path": "", + "bundle_validation_errors_on_master": [], + "checksum": "", + "timestamp": 0 + }, + "reload_bundle_issued": false, + "status": "None" + }, + "backup_and_restore_primaries": false, + "controlled_rolling_restart_flag": false, + "eai:acl": null, + "indexing_ready_flag": true, + "initialized_flag": true, + "label": "splunk-stack1-cluster-master-0", + "last_check_restart_bundle_result": false, + "last_dry_run_bundle": { + "bundle_path": "", + "checksum": "", + "timestamp": 0 + }, + "last_validated_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/0af7c0e95f313f7be3b0cb1d878df9a1-1583948640.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "is_valid_bundle": true, + "timestamp": 1583948640 + }, + "latest_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle", + "checksum": "14310A4AABD23E85BBD4559C4A3B59F8", + "timestamp": 1583870198 + }, + "maintenance_mode": false, + "multisite": false, + "previous_active_bundle": { + "bundle_path": "", + "checksum": "", + "timestamp": 0 + }, + "primaries_backup_status": "No on-going (or) completed primaries backup yet. Check back again in few minutes if you expect a backup.", + "quiet_period_flag": false, + "rolling_restart_flag": false, + "rolling_restart_or_upgrade": false, + "service_ready_flag": true, + "start_time": 1583948636, + "summary_replication": "false" + } + } + ], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/update_status_invalid_response1.json b/pkg/splunk/common/testdata/fixtures/update_status_invalid_response1.json new file mode 100644 index 000000000..74bec62b0 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/update_status_invalid_response1.json @@ -0,0 +1,113 @@ +{ + "links": { + "create": "/services/cluster/master/peers/_new" + }, + "origin": "https://localhost:8089/services/cluster/master/peers", + "updated": "2020-03-18T01:08:53+00:00", + "generator": { + "build": "a7f645ddaf91", + "version": "8.0.2" + }, + "entry": [ + { + "name": "D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "id": "https://localhost:8089/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "list": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866", + "edit": "/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "active_bundle_id": "14310A4AABD23E85BBD4559C4A3B59F8", + "apply_bundle_status": { + "invalid_bundle": { + "bundle_validation_errors": [], + "invalid_bundle_id": "" + }, + "reasons_for_restart": [], + "restart_required_for_apply_bundle": false, + "status": "None" + }, + "base_generation_id": 26, + "bucket_count": 73, + "bucket_count_by_index": { + "_audit": 24, + "_internal": 45, + "_telemetry": 4 + }, + "buckets_rf_by_origin_site": { + "default": 73 + }, + "buckets_sf_by_origin_site": { + "default": 73 + }, + "delayed_buckets_to_discard": [], + "eai:acl": null, + "fixup_set": [], + "heartbeat_started": true, + "host_port_pair": "10.36.0.6:8089", + "indexing_disk_space": 210707374080, + "is_searchable": true, + "is_valid_bundle": true, + "label": "splunk-stack1-indexer-0", + "last_dry_run_bundle": "", + "last_heartbeat": 1584493732, + "last_validated_bundle": "14310A4AABD23E85BBD4559C4A3B59F8", + "latest_bundle_id": "14310A4AABD23E85BBD4559C4A3B59F8", + "peer_registered_summaries": true, + "pending_builds": [], + "pending_job_count": 0, + "primary_count": 73, + "primary_count_remote": 0, + "register_search_address": "10.36.0.6:8089", + "replication_count": 0, + "replication_port": 9887, + "replication_use_ssl": false, + "restart_required_for_applying_dry_run_bundle": false, + "search_state_counter": { + "PendingSearchable": 0, + "Searchable": 73, + "SearchablePendingMask": 0, + "Unsearchable": 0 + }, + "site": "default", + "splunk_version": "8.0.2", + "status": "Up", + "status_counter": { + "Complete": 69, + "NonStreamingTarget": 0, + "StreamingSource": 4, + "StreamingTarget": 0 + }, + "summary_replication_count": 0 + } + } + ], + "paging": { + "total": 1, + "perPage": 30, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/verify_rf_peers.json b/pkg/splunk/common/testdata/fixtures/verify_rf_peers.json new file mode 100644 index 000000000..fb8c9d271 --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/verify_rf_peers.json @@ -0,0 +1,116 @@ +{ + "links": { + "_reload": "/services/cluster/config/_reload", + "_acl": "/services/cluster/config/_acl" + }, + "origin": "https://localhost:8089/services/cluster/config", + "updated": "2020-10-28T21:37:07+00:00", + "generator": { + "build": "152fb4b2bb96", + "version": "8.0.6" + }, + "entry": [ + { + "name": "config", + "id": "https://localhost:8089/services/cluster/config/config", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/config/config", + "list": "/services/cluster/config/config", + "_reload": "/services/cluster/config/config/_reload", + "edit": "/services/cluster/config/config", + "disable": "/services/cluster/config/config/disable" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "access_logging_for_heartbeats": false, + "auto_rebalance_primaries": true, + "buckets_to_summarize": "primaries", + "cluster_label": "idxc_label", + "cxn_timeout": 60, + "decommission_force_finish_idle_time": 0, + "decommission_force_timeout": 180, + "disabled": false, + "eai:acl": null, + "forwarderdata_rcv_port": 0, + "forwarderdata_use_ssl": false, + "frozen_notifications_per_batch": 10, + "guid": "F643BA71-0D3C-4D63-A0BC-A1604AC928E3", + "heartbeat_period": 18446744073709552000, + "heartbeat_timeout": 60, + "master_uri": "https://127.0.0.1:8089", + "max_auto_service_interval": 30, + "max_fixup_time_ms": 5000, + "max_peer_build_load": 2, + "max_peer_rep_load": 5, + "max_peer_sum_rep_load": 5, + "max_peers_to_download_bundle": 5, + "max_primary_backups_per_service": 10, + "mode": "master", + "multisite": "false", + "notify_buckets_period": 10, + "notify_scan_min_period": 10, + "notify_scan_period": 10, + "percent_peers_to_restart": 10, + "ping_flag": true, + "quiet_period": 60, + "rcv_timeout": 60, + "rebalance_primaries_execution_limit_ms": 0, + "rebalance_threshold": 0.9, + "register_forwarder_address": "", + "register_replication_address": "", + "register_search_address": "", + "remote_storage_upload_timeout": 60, + "rep_cxn_timeout": 60, + "rep_max_rcv_timeout": 180, + "rep_max_send_timeout": 180, + "rep_rcv_timeout": 60, + "rep_send_timeout": 60, + "replication_factor": 3, + "replication_port": null, + "replication_use_ssl": false, + "report_remote_storage_bucket_upload_to_targets": false, + "reporting_delay_period": 30, + "restart_inactivity_timeout": 600, + "restart_timeout": 60, + "rolling_restart": "restart", + "search_factor": 3, + "search_files_retry_timeout": 600, + "secret": "********", + "send_timeout": 60, + "service_interval": 0, + "site": "default", + "site_by_site": true, + "summary_replication": "false", + "use_batch_discard": "true", + "use_batch_mask_changes": "true", + "use_batch_remote_rep_changes": "false" + } + } + ], + "paging": { + "total": 1, + "perPage": 10000000, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/testdata/fixtures/verify_rf_peers_multi_site.json b/pkg/splunk/common/testdata/fixtures/verify_rf_peers_multi_site.json new file mode 100644 index 000000000..f53dbc79e --- /dev/null +++ b/pkg/splunk/common/testdata/fixtures/verify_rf_peers_multi_site.json @@ -0,0 +1,118 @@ +{ + "links": { + "_reload": "/services/cluster/config/_reload", + "_acl": "/services/cluster/config/_acl" + }, + "origin": "https://localhost:8089/services/cluster/config", + "updated": "2020-10-28T21:37:07+00:00", + "generator": { + "build": "152fb4b2bb96", + "version": "8.0.6" + }, + "entry": [ + { + "name": "config", + "id": "https://localhost:8089/services/cluster/config/config", + "updated": "1970-01-01T00:00:00+00:00", + "links": { + "alternate": "/services/cluster/config/config", + "list": "/services/cluster/config/config", + "_reload": "/services/cluster/config/config/_reload", + "edit": "/services/cluster/config/config", + "disable": "/services/cluster/config/config/disable" + }, + "author": "system", + "acl": { + "app": "", + "can_list": true, + "can_write": true, + "modifiable": false, + "owner": "system", + "perms": { + "read": [ + "admin", + "splunk-system-role" + ], + "write": [ + "admin", + "splunk-system-role" + ] + }, + "removable": false, + "sharing": "system" + }, + "content": { + "access_logging_for_heartbeats": false, + "auto_rebalance_primaries": true, + "buckets_to_summarize": "primaries", + "cluster_label": "idxc_label", + "cxn_timeout": 60, + "decommission_force_finish_idle_time": 0, + "decommission_force_timeout": 180, + "disabled": false, + "eai:acl": null, + "forwarderdata_rcv_port": 0, + "forwarderdata_use_ssl": false, + "frozen_notifications_per_batch": 10, + "guid": "F643BA71-0D3C-4D63-A0BC-A1604AC928E3", + "heartbeat_period": 18446744073709552000, + "heartbeat_timeout": 60, + "master_uri": "https://127.0.0.1:8089", + "max_auto_service_interval": 30, + "max_fixup_time_ms": 5000, + "max_peer_build_load": 2, + "max_peer_rep_load": 5, + "max_peer_sum_rep_load": 5, + "max_peers_to_download_bundle": 5, + "max_primary_backups_per_service": 10, + "mode": "master", + "multisite": "true", + "notify_buckets_period": 10, + "notify_scan_min_period": 10, + "notify_scan_period": 10, + "percent_peers_to_restart": 10, + "ping_flag": true, + "quiet_period": 60, + "rcv_timeout": 60, + "rebalance_primaries_execution_limit_ms": 0, + "rebalance_threshold": 0.9, + "register_forwarder_address": "", + "register_replication_address": "", + "register_search_address": "", + "remote_storage_upload_timeout": 60, + "rep_cxn_timeout": 60, + "rep_max_rcv_timeout": 180, + "rep_max_send_timeout": 180, + "rep_rcv_timeout": 60, + "rep_send_timeout": 60, + "replication_factor": 3, + "replication_port": null, + "replication_use_ssl": false, + "report_remote_storage_bucket_upload_to_targets": false, + "reporting_delay_period": 30, + "restart_inactivity_timeout": 600, + "restart_timeout": 60, + "rolling_restart": "restart", + "search_factor": 3, + "search_files_retry_timeout": 600, + "secret": "********", + "send_timeout": 60, + "service_interval": 0, + "site": "site1", + "site_by_site": true, + "site_replication_factor": "{ origin:2, total:2 }", + "site_search_factor": "{ origin:2, total:2 }", + "summary_replication": "false", + "use_batch_discard": "true", + "use_batch_mask_changes": "true", + "use_batch_remote_rep_changes": "false" + } + } + ], + "paging": { + "total": 1, + "perPage": 10000000, + "offset": 0 + }, + "messages": [] +} diff --git a/pkg/splunk/common/urls_testingcode.go b/pkg/splunk/common/urls_testingcode.go index 249c20c8a..6864b534a 100644 --- a/pkg/splunk/common/urls_testingcode.go +++ b/pkg/splunk/common/urls_testingcode.go @@ -1,5 +1,11 @@ package common +import ( + "bytes" + _ "embed" + "encoding/json" +) + // Endpoints // List of all endpoints (Full URls) used by the Testing code @@ -143,165 +149,228 @@ const ( // ***** Body Responses ***** -// JSON body responses Testing code -const ( - - //TestGetMonitoringConsoleStatefulSet - TestGetMonitoringConsoleStatefulSet = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-test-monitoring-console","namespace":"test","creationTimestamp":null},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-test-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-test-monitoring-console"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-test-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-test-monitoring-console"},"annotations":{"monitoringConsoleConfigRev":"","traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"mnt-splunk-etc","emptyDir":{}},{"name":"mnt-splunk-var","emptyDir":{}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-test-secret","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"envFrom":[{"configMapRef":{"name":"splunk-test-monitoring-console"}}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_monitor"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack1-cluster-master-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"mnt-splunk-etc","mountPath":"/opt/splunk/etc"},{"name":"mnt-splunk-var","mountPath":"/opt/splunk/var"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":300,"timeoutSeconds":30,"periodSeconds":30},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":16},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch","fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-test-monitoring-console"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"serviceName":"splunk-test-monitoring-console-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"availableReplicas":0, "replicas":0}}` - - //TestGetSearchHeadStatefulSet - TestGetSearchHeadStatefulSet = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-search-head","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"},"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":5,"selector":{"matchLabels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-search-head-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_search_head"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_SEARCH_HEAD_URL","value":"splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-1.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-2.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-3.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-4.splunk-stack1-search-head-headless.test.svc.cluster.local"},{"name":"SPLUNK_SEARCH_HEAD_CAPTAIN_URL","value":"splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local"},{"name":"SPLUNK_DEPLOYER_URL","value":"splunk-stack1-deployer-service"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack1-cluster-master-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-search-head"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-search-head-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` - - //TestGetSearchHeadStatefulSetT2 - TestGetSearchHeadStatefulSetT2 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-search-head","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":6,"selector":{"matchLabels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-search-head-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_search_head"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_SEARCH_HEAD_URL","value":"splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-1.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-2.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-3.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-4.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-5.splunk-stack1-search-head-headless.test.svc.cluster.local"},{"name":"SPLUNK_SEARCH_HEAD_CAPTAIN_URL","value":"splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local"},{"name":"SPLUNK_DEPLOYER_URL","value":"splunk-stack1-deployer-service"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack1-cluster-master-service.test2.svc.cluster.local"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-search-head"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-search-head-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` - - //TestGetSearchHeadStatefulSetT3 - TestGetSearchHeadStatefulSetT3 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-search-head","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":6,"selector":{"matchLabels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-search-head-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_search_head"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_SEARCH_HEAD_URL","value":"splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-1.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-2.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-3.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-4.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-5.splunk-stack1-search-head-headless.test.svc.cluster.local"},{"name":"SPLUNK_SEARCH_HEAD_CAPTAIN_URL","value":"splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local"},{"name":"SPLUNK_DEPLOYER_URL","value":"splunk-stack1-deployer-service"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack1-cluster-master-service.test2.svc.cluster.local"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-search-head"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-search-head-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` - - //TestGetSearchHeadStatefulSetT - TestGetSearchHeadStatefulSetT4 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-search-head","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":6,"selector":{"matchLabels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-search-head-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_search_head"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_SEARCH_HEAD_URL","value":"splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-1.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-2.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-3.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-4.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-5.splunk-stack1-search-head-headless.test.svc.cluster.local"},{"name":"SPLUNK_SEARCH_HEAD_CAPTAIN_URL","value":"splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local"},{"name":"SPLUNK_DEPLOYER_URL","value":"splunk-stack1-deployer-service"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack1-cluster-master-service.test2.svc.cluster.local"},{"name":"TEST_ENV_VAR","value":"test_value"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-search-head"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-search-head-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` - - //TestGetSearchHeadStatefulSetApps - TestGetSearchHeadStatefulSetApps = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-search-head","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":6,"selector":{"matchLabels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-search-head-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_search_head"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_SEARCH_HEAD_URL","value":"splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-1.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-2.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-3.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-4.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-5.splunk-stack1-search-head-headless.test.svc.cluster.local"},{"name":"SPLUNK_SEARCH_HEAD_CAPTAIN_URL","value":"splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local"},{"name":"SPLUNK_DEPLOYER_URL","value":"splunk-stack1-deployer-service"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack1-cluster-master-service.test2.svc.cluster.local"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-search-head"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-search-head-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` - - //TestGetSearchHeadStatefulSetNewPort - TestGetSearchHeadStatefulSetNewPort = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-search-head","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":6,"selector":{"matchLabels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-search-head-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_search_head"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_SEARCH_HEAD_URL","value":"splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-1.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-2.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-3.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-4.splunk-stack1-search-head-headless.test.svc.cluster.local,splunk-stack1-search-head-5.splunk-stack1-search-head-headless.test.svc.cluster.local"},{"name":"SPLUNK_SEARCH_HEAD_CAPTAIN_URL","value":"splunk-stack1-search-head-0.splunk-stack1-search-head-headless.test.svc.cluster.local"},{"name":"SPLUNK_DEPLOYER_URL","value":"splunk-stack1-deployer-service"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack1-cluster-master-service.test2.svc.cluster.local"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-search-head"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"search-head","app.kubernetes.io/instance":"splunk-stack1-search-head","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"search-head","app.kubernetes.io/part-of":"splunk-stack1-search-head"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-search-head-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` - - //TestGetClusterMasterStatefulSet - TestGetCMStatefulSet = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-cluster-master","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-cluster-master-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_cluster_master"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-cluster-master"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-cluster-master-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` - - //TestGetClusterMasterStatefulSetLicense - TestGetCMStatefulSetLicense = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-cluster-master","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-cluster-master-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_cluster_master"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_LICENSE_MASTER_URL","value":"splunk-stack1-license-master-service.test.svc.cluster.local"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-cluster-master"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-cluster-master-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` - - //TestGetClusterMasterStatefulSetURL - TestGetCMStatefulSetURL = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-cluster-master","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-cluster-master-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_cluster_master"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_LICENSE_URI","value":"/mnt/splunk.lic"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-cluster-master"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-cluster-master-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` - - //TestGetClusterMasterStatefulSetApps - TestGetCMStatefulSetApps = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-cluster-master","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-cluster-master-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_cluster_master"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_LICENSE_URI","value":"/mnt/splunk.lic"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-cluster-master"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-cluster-master-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` - - //TestGetClusterMasterStatefulSetServiceAccount - TestGetCMStatefulSetServiceAccount = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-cluster-master","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-cluster-master-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_cluster_master"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_LICENSE_URI","value":"/mnt/splunk.lic"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-cluster-master"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-cluster-master-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` - - //TestGetClusterMasterStatefulSetExtraEnv - TestGetCMStatefulSetExtraEnv = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-cluster-master","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-cluster-master-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_cluster_master"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_LICENSE_URI","value":"/mnt/splunk.lic"},{"name":"TEST_ENV_VAR","value":"test_value"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-cluster-master"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-stack1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-cluster-master-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` - - //TestGetClusterMasterInfo - TestGetCMInfo = `{"links":{},"origin":"https://localhost:8089/services/cluster/master/info","updated":"2020-03-18T01:04:53+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[{"name":"master","id":"https://localhost:8089/services/cluster/master/info/master","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/master/info/master","list":"/services/cluster/master/info/master"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"active_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","timestamp":1583870198},"apply_bundle_status":{"invalid_bundle":{"bundle_path":"","bundle_validation_errors_on_master":[],"checksum":"","timestamp":0},"reload_bundle_issued":false,"status":"None"},"backup_and_restore_primaries":false,"controlled_rolling_restart_flag":false,"eai:acl":null,"indexing_ready_flag":true,"initialized_flag":true,"label":"splunk-s1-cluster-master-0","last_check_restart_bundle_result":false,"last_dry_run_bundle":{"bundle_path":"","checksum":"","timestamp":0},"last_validated_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/0af7c0e95f313f7be3b0cb1d878df9a1-1583948640.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","is_valid_bundle":true,"timestamp":1583948640},"latest_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","timestamp":1583870198},"maintenance_mode":false,"multisite":false,"previous_active_bundle":{"bundle_path":"","checksum":"","timestamp":0},"primaries_backup_status":"No on-going (or) completed primaries backup yet. Check back again in few minutes if you expect a backup.","quiet_period_flag":false,"rolling_restart_flag":false,"rolling_restart_or_upgrade":false,"service_ready_flag":true,"start_time":1583948636,"summary_replication":"false"}}],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` - - //TestGetClusterMasterInfoEmpty - TestGetCMInfoEmpty = `{"links":{},"origin":"https://localhost:8089/services/cluster/master/info","updated":"2020-03-18T01:04:53+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` - - //TestGetClusterMasterPeers - TestGetCMPeers = `{"links":{"create":"/services/cluster/master/peers/_new"},"origin":"https://localhost:8089/services/cluster/master/peers","updated":"2020-03-18T01:08:53+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[{"name":"D39B1729-E2C5-4273-B9B2-534DA7C2F866","id":"https://localhost:8089/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","list":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","edit":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"active_bundle_id":"14310A4AABD23E85BBD4559C4A3B59F8","apply_bundle_status":{"invalid_bundle":{"bundle_validation_errors":[],"invalid_bundle_id":""},"reasons_for_restart":[],"restart_required_for_apply_bundle":false,"status":"None"},"base_generation_id":26,"bucket_count":73,"bucket_count_by_index":{"_audit":24,"_internal":45,"_telemetry":4},"buckets_rf_by_origin_site":{"default":73},"buckets_sf_by_origin_site":{"default":73},"delayed_buckets_to_discard":[],"eai:acl":null,"fixup_set":[],"heartbeat_started":true,"host_port_pair":"10.36.0.6:8089","indexing_disk_space":210707374080,"is_searchable":true,"is_valid_bundle":true,"label":"splunk-s1-indexer-0","last_dry_run_bundle":"","last_heartbeat":1584493732,"last_validated_bundle":"14310A4AABD23E85BBD4559C4A3B59F8","latest_bundle_id":"14310A4AABD23E85BBD4559C4A3B59F8","peer_registered_summaries":true,"pending_builds":[],"pending_job_count":0,"primary_count":73,"primary_count_remote":0,"register_search_address":"10.36.0.6:8089","replication_count":0,"replication_port":9887,"replication_use_ssl":false,"restart_required_for_applying_dry_run_bundle":false,"search_state_counter":{"PendingSearchable":0,"Searchable":73,"SearchablePendingMask":0,"Unsearchable":0},"site":"default","splunk_version":"8.0.2","status":"Up","status_counter":{"Complete":69,"NonStreamingTarget":0,"StreamingSource":4,"StreamingTarget":0},"summary_replication_count":0}}],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` +// JSON body responses loaded from fixture files +// +//nolint:gochecknoinits +func init() { + compact := func(s *string) { + var buf bytes.Buffer + if err := json.Compact(&buf, []byte(*s)); err == nil { + *s = buf.String() + } + } + compact(&TestGetMonitoringConsoleStatefulSet) + compact(&TestGetSearchHeadStatefulSet) + compact(&TestGetSearchHeadStatefulSetT2) + compact(&TestGetSearchHeadStatefulSetT3) + compact(&TestGetSearchHeadStatefulSetT4) + compact(&TestGetSearchHeadStatefulSetApps) + compact(&TestGetSearchHeadStatefulSetNewPort) + compact(&TestGetCMStatefulSet) + compact(&TestGetCMStatefulSetLicense) + compact(&TestGetCMStatefulSetURL) + compact(&TestGetCMStatefulSetApps) + compact(&TestGetCMStatefulSetServiceAccount) + compact(&TestGetCMStatefulSetExtraEnv) + compact(&TestGetCMInfo) + compact(&TestGetCMInfoEmpty) + compact(&TestGetCMPeers) + compact(&TestGetIndexerClusterPeerInfo) + compact(&TestGetIndexerClusterPeerInfoEmpty) + compact(&TestUpdateStatusInvalidResponse0) + compact(&TestUpdateStatusInvalidResponse1) + compact(&TestInvalidPeerStatusInScaleDownInfo) + compact(&TestInvalidPeerStatusInScaleDownPeer) + compact(&TestInvalidPeerInFinishRecycleInfo) + compact(&TestInvalidPeerInFinishRecyclePeer) + compact(&TestIndexerClusterPodManagerInfo) + compact(&TestIndexerClusterPodManagerPeer) + compact(&TestGetIndexerStatefulSettest0) + compact(&TestGetIndexerStatefulSettest1) + compact(&TestGetIndexerStatefulSettest2) + compact(&TestGetIndexerStatefulSettest3) + compact(&TestGetIndexerStatefulSettest4) + compact(&TestGetIndexerStatefulSettest5) + compact(&TestMCApplyChanges) + compact(&TestGetMCAssetTable) + compact(&TestGetClusterInfo) + compact(&TestGetLMStatefulSetT1) + compact(&TestGetLMStatefulSetT2) + compact(&TestGetLMStatefulSetT3) + compact(&TestGetLMStatefulSetT4) + compact(&TestGetLMStatefulSetT5) + compact(&TestVerifyRFPeers) + compact(&TestVerifyRFPeersMultiSite) + compact(&TestGetStandaloneStatefulSetT1) + compact(&TestGetStandaloneStatefulSetT2) + compact(&TestGetStandaloneStatefulSetT3) + compact(&TestGetStandaloneStatefulSetT4) + compact(&TestApplyAppListingConfigMap) + compact(&TestGetMonitoringConsoleStatefulSetT1) + compact(&TestGetMonitoringConsoleStatefulSetT2) + compact(&TestGetMonitoringConsoleStatefulSetT3) + compact(&TestGetMonitoringConsoleStatefulSetT4) + compact(&TestGetMonitoringConsoleStatefulSetT5) + compact(&TestGetMonitoringConsoleStatefulSetT6) +} + +var ( + //go:embed testdata/fixtures/get_monitoring_console_stateful_set.json + TestGetMonitoringConsoleStatefulSet string + + //go:embed testdata/fixtures/get_search_head_stateful_set.json + TestGetSearchHeadStatefulSet string + + //go:embed testdata/fixtures/get_search_head_stateful_set_t2.json + TestGetSearchHeadStatefulSetT2 string + + //go:embed testdata/fixtures/get_search_head_stateful_set_t3.json + TestGetSearchHeadStatefulSetT3 string + + //go:embed testdata/fixtures/get_search_head_stateful_set_t4.json + TestGetSearchHeadStatefulSetT4 string + + //go:embed testdata/fixtures/get_search_head_stateful_set_apps.json + TestGetSearchHeadStatefulSetApps string + + //go:embed testdata/fixtures/get_search_head_stateful_set_new_port.json + TestGetSearchHeadStatefulSetNewPort string + + //go:embed testdata/fixtures/get_cm_stateful_set.json + TestGetCMStatefulSet string + + //go:embed testdata/fixtures/get_cm_stateful_set_license.json + TestGetCMStatefulSetLicense string + + //go:embed testdata/fixtures/get_cm_stateful_set_url.json + TestGetCMStatefulSetURL string + + //go:embed testdata/fixtures/get_cm_stateful_set_apps.json + TestGetCMStatefulSetApps string + + //go:embed testdata/fixtures/get_cm_stateful_set_service_account.json + TestGetCMStatefulSetServiceAccount string + + //go:embed testdata/fixtures/get_cm_stateful_set_extra_env.json + TestGetCMStatefulSetExtraEnv string + + //go:embed testdata/fixtures/get_cm_info.json + TestGetCMInfo string + + //go:embed testdata/fixtures/get_cm_info_empty.json + TestGetCMInfoEmpty string + + //go:embed testdata/fixtures/get_cm_peers.json + TestGetCMPeers string - //TestGetIndexerClusterPeerInfo - TestGetIndexerClusterPeerInfo = `{"links":{},"origin":"https://localhost:8089/services/cluster/slave/info","updated":"2020-03-18T01:28:18+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[{"name":"slave","id":"https://localhost:8089/services/cluster/slave/info/slave","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/slave/info/slave","list":"/services/cluster/slave/info/slave"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"active_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/87c8c24e7fabc3ff9683c26652cb5890-1583870244.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","timestamp":1583870244},"base_generation_id":26,"eai:acl":null,"is_registered":true,"last_dry_run_bundle":{"bundle_path":"","checksum":"","timestamp":0},"last_heartbeat_attempt":0,"latest_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/87c8c24e7fabc3ff9683c26652cb5890-1583870244.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","timestamp":1583870244},"maintenance_mode":false,"registered_summary_state":3,"restart_state":"NoRestart","site":"default","status":"Up"}}],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/get_indexer_cluster_peer_info.json + TestGetIndexerClusterPeerInfo string - //TestGetIndexerClusterPeerInfoEmpty - TestGetIndexerClusterPeerInfoEmpty = `{"links":{},"origin":"https://localhost:8089/services/cluster/slave/info","updated":"2020-03-18T01:28:18+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/get_indexer_cluster_peer_info_empty.json + TestGetIndexerClusterPeerInfoEmpty string - //TestUpdateStatusInvalidResponse0 - TestUpdateStatusInvalidResponse0 = `{"links":{},"origin":"https://localhost:8089/services/cluster/master/info","updated":"2020-03-18T01:04:53+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[{"name":"master","id":"https://localhost:8089/services/cluster/master/info/master","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/master/info/master","list":"/services/cluster/master/info/master"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"active_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","timestamp":1583870198},"apply_bundle_status":{"invalid_bundle":{"bundle_path":"","bundle_validation_errors_on_master":[],"checksum":"","timestamp":0},"reload_bundle_issued":false,"status":"None"},"backup_and_restore_primaries":false,"controlled_rolling_restart_flag":false,"eai:acl":null,"indexing_ready_flag":true,"initialized_flag":true,"label":"splunk-stack1-cluster-master-0","last_check_restart_bundle_result":false,"last_dry_run_bundle":{"bundle_path":"","checksum":"","timestamp":0},"last_validated_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/0af7c0e95f313f7be3b0cb1d878df9a1-1583948640.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","is_valid_bundle":true,"timestamp":1583948640},"latest_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","timestamp":1583870198},"maintenance_mode":false,"multisite":false,"previous_active_bundle":{"bundle_path":"","checksum":"","timestamp":0},"primaries_backup_status":"No on-going (or) completed primaries backup yet. Check back again in few minutes if you expect a backup.","quiet_period_flag":false,"rolling_restart_flag":false,"rolling_restart_or_upgrade":false,"service_ready_flag":true,"start_time":1583948636,"summary_replication":"false"}}],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/update_status_invalid_response0.json + TestUpdateStatusInvalidResponse0 string - //TestUpdateStatusInvalidResponse1 - TestUpdateStatusInvalidResponse1 = `{"links":{"create":"/services/cluster/master/peers/_new"},"origin":"https://localhost:8089/services/cluster/master/peers","updated":"2020-03-18T01:08:53+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[{"name":"D39B1729-E2C5-4273-B9B2-534DA7C2F866","id":"https://localhost:8089/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","list":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","edit":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"active_bundle_id":"14310A4AABD23E85BBD4559C4A3B59F8","apply_bundle_status":{"invalid_bundle":{"bundle_validation_errors":[],"invalid_bundle_id":""},"reasons_for_restart":[],"restart_required_for_apply_bundle":false,"status":"None"},"base_generation_id":26,"bucket_count":73,"bucket_count_by_index":{"_audit":24,"_internal":45,"_telemetry":4},"buckets_rf_by_origin_site":{"default":73},"buckets_sf_by_origin_site":{"default":73},"delayed_buckets_to_discard":[],"eai:acl":null,"fixup_set":[],"heartbeat_started":true,"host_port_pair":"10.36.0.6:8089","indexing_disk_space":210707374080,"is_searchable":true,"is_valid_bundle":true,"label":"splunk-stack1-indexer-0","last_dry_run_bundle":"","last_heartbeat":1584493732,"last_validated_bundle":"14310A4AABD23E85BBD4559C4A3B59F8","latest_bundle_id":"14310A4AABD23E85BBD4559C4A3B59F8","peer_registered_summaries":true,"pending_builds":[],"pending_job_count":0,"primary_count":73,"primary_count_remote":0,"register_search_address":"10.36.0.6:8089","replication_count":0,"replication_port":9887,"replication_use_ssl":false,"restart_required_for_applying_dry_run_bundle":false,"search_state_counter":{"PendingSearchable":0,"Searchable":73,"SearchablePendingMask":0,"Unsearchable":0},"site":"default","splunk_version":"8.0.2","status":"Up","status_counter":{"Complete":69,"NonStreamingTarget":0,"StreamingSource":4,"StreamingTarget":0},"summary_replication_count":0}}],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/update_status_invalid_response1.json + TestUpdateStatusInvalidResponse1 string - //TestInvalidPeerStatusInScaleDownInfo - TestInvalidPeerStatusInScaleDownInfo = `{"links":{},"origin":"https://localhost:8089/services/cluster/master/info","updated":"2020-03-18T01:04:53+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[{"name":"master","id":"https://localhost:8089/services/cluster/master/info/master","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/master/info/master","list":"/services/cluster/master/info/master"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"active_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","timestamp":1583870198},"apply_bundle_status":{"invalid_bundle":{"bundle_path":"","bundle_validation_errors_on_master":[],"checksum":"","timestamp":0},"reload_bundle_issued":false,"status":"None"},"backup_and_restore_primaries":false,"controlled_rolling_restart_flag":false,"eai:acl":null,"indexing_ready_flag":true,"initialized_flag":true,"label":"splunk-stack1-cluster-master-0","last_check_restart_bundle_result":false,"last_dry_run_bundle":{"bundle_path":"","checksum":"","timestamp":0},"last_validated_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/0af7c0e95f313f7be3b0cb1d878df9a1-1583948640.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","is_valid_bundle":true,"timestamp":1583948640},"latest_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","timestamp":1583870198},"maintenance_mode":false,"multisite":false,"previous_active_bundle":{"bundle_path":"","checksum":"","timestamp":0},"primaries_backup_status":"No on-going (or) completed primaries backup yet. Check back again in few minutes if you expect a backup.","quiet_period_flag":false,"rolling_restart_flag":false,"rolling_restart_or_upgrade":false,"service_ready_flag":true,"start_time":1583948636,"summary_replication":"false"}}],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/invalid_peer_status_in_scale_down_info.json + TestInvalidPeerStatusInScaleDownInfo string - //TestInvalidPeerStatusInScaleDownPeer - TestInvalidPeerStatusInScaleDownPeer = `{"links":{"create":"/services/cluster/master/peers/_new"},"origin":"https://localhost:8089/services/cluster/master/peers","updated":"2020-03-18T01:08:53+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[{"name":"D39B1729-E2C5-4273-B9B2-534DA7C2F866","id":"https://localhost:8089/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","list":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","edit":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"active_bundle_id":"14310A4AABD23E85BBD4559C4A3B59F8","apply_bundle_status":{"invalid_bundle":{"bundle_validation_errors":[],"invalid_bundle_id":""},"reasons_for_restart":[],"restart_required_for_apply_bundle":false,"status":"None"},"base_generation_id":26,"bucket_count":73,"bucket_count_by_index":{"_audit":24,"_internal":45,"_telemetry":4},"buckets_rf_by_origin_site":{"default":73},"buckets_sf_by_origin_site":{"default":73},"delayed_buckets_to_discard":[],"eai:acl":null,"fixup_set":[],"heartbeat_started":true,"host_port_pair":"10.36.0.6:8089","indexing_disk_space":210707374080,"is_searchable":true,"is_valid_bundle":true,"label":"splunk-stack1-indexer-0","last_dry_run_bundle":"","last_heartbeat":1584493732,"last_validated_bundle":"14310A4AABD23E85BBD4559C4A3B59F8","latest_bundle_id":"14310A4AABD23E85BBD4559C4A3B59F8","peer_registered_summaries":true,"pending_builds":[],"pending_job_count":0,"primary_count":73,"primary_count_remote":0,"register_search_address":"10.36.0.6:8089","replication_count":0,"replication_port":9887,"replication_use_ssl":false,"restart_required_for_applying_dry_run_bundle":false,"search_state_counter":{"PendingSearchable":0,"Searchable":73,"SearchablePendingMask":0,"Unsearchable":0},"site":"default","splunk_version":"8.0.2","status":"Invalid_Status","status_counter":{"Complete":69,"NonStreamingTarget":0,"StreamingSource":4,"StreamingTarget":0},"summary_replication_count":0}}],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/invalid_peer_status_in_scale_down_peer.json + TestInvalidPeerStatusInScaleDownPeer string - //TestInvalidPeerInFinishRecycleInfo - TestInvalidPeerInFinishRecycleInfo = `{"links":{},"origin":"https://localhost:8089/services/cluster/master/info","updated":"2020-03-18T01:04:53+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[{"name":"master","id":"https://localhost:8089/services/cluster/master/info/master","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/master/info/master","list":"/services/cluster/master/info/master"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"active_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","timestamp":1583870198},"apply_bundle_status":{"invalid_bundle":{"bundle_path":"","bundle_validation_errors_on_master":[],"checksum":"","timestamp":0},"reload_bundle_issued":false,"status":"None"},"backup_and_restore_primaries":false,"controlled_rolling_restart_flag":false,"eai:acl":null,"indexing_ready_flag":true,"initialized_flag":true,"label":"splunk-stack1-cluster-master-0","last_check_restart_bundle_result":false,"last_dry_run_bundle":{"bundle_path":"","checksum":"","timestamp":0},"last_validated_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/0af7c0e95f313f7be3b0cb1d878df9a1-1583948640.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","is_valid_bundle":true,"timestamp":1583948640},"latest_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","timestamp":1583870198},"maintenance_mode":false,"multisite":false,"previous_active_bundle":{"bundle_path":"","checksum":"","timestamp":0},"primaries_backup_status":"No on-going (or) completed primaries backup yet. Check back again in few minutes if you expect a backup.","quiet_period_flag":false,"rolling_restart_flag":false,"rolling_restart_or_upgrade":false,"service_ready_flag":true,"start_time":1583948636,"summary_replication":"false"}}],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/invalid_peer_in_finish_recycle_info.json + TestInvalidPeerInFinishRecycleInfo string - //TestInvalidPeerInFinishRecyclePeer - TestInvalidPeerInFinishRecyclePeer = `{"links":{"create":"/services/cluster/master/peers/_new"},"origin":"https://localhost:8089/services/cluster/master/peers","updated":"2020-03-18T01:08:53+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[{"name":"D39B1729-E2C5-4273-B9B2-534DA7C2F866","id":"https://localhost:8089/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","list":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","edit":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"active_bundle_id":"14310A4AABD23E85BBD4559C4A3B59F8","apply_bundle_status":{"invalid_bundle":{"bundle_validation_errors":[],"invalid_bundle_id":""},"reasons_for_restart":[],"restart_required_for_apply_bundle":false,"status":"None"},"base_generation_id":26,"bucket_count":73,"bucket_count_by_index":{"_audit":24,"_internal":45,"_telemetry":4},"buckets_rf_by_origin_site":{"default":73},"buckets_sf_by_origin_site":{"default":73},"delayed_buckets_to_discard":[],"eai:acl":null,"fixup_set":[],"heartbeat_started":true,"host_port_pair":"10.36.0.6:8089","indexing_disk_space":210707374080,"is_searchable":true,"is_valid_bundle":true,"label":"splunk-stack1-indexer-0","last_dry_run_bundle":"","last_heartbeat":1584493732,"last_validated_bundle":"14310A4AABD23E85BBD4559C4A3B59F8","latest_bundle_id":"14310A4AABD23E85BBD4559C4A3B59F8","peer_registered_summaries":true,"pending_builds":[],"pending_job_count":0,"primary_count":73,"primary_count_remote":0,"register_search_address":"10.36.0.6:8089","replication_count":0,"replication_port":9887,"replication_use_ssl":false,"restart_required_for_applying_dry_run_bundle":false,"search_state_counter":{"PendingSearchable":0,"Searchable":73,"SearchablePendingMask":0,"Unsearchable":0},"site":"default","splunk_version":"8.0.2","status":"Up","status_counter":{"Complete":69,"NonStreamingTarget":0,"StreamingSource":4,"StreamingTarget":0},"summary_replication_count":0}}],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/invalid_peer_in_finish_recycle_peer.json + TestInvalidPeerInFinishRecyclePeer string - //TestIndexerClusterPodManagerInfo - TestIndexerClusterPodManagerInfo = `{"links":{},"origin":"https://localhost:8089/services/cluster/master/info","updated":"2020-03-18T01:04:53+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[{"name":"master","id":"https://localhost:8089/services/cluster/master/info/master","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/master/info/master","list":"/services/cluster/master/info/master"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"active_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","timestamp":1583870198},"apply_bundle_status":{"invalid_bundle":{"bundle_path":"","bundle_validation_errors_on_master":[],"checksum":"","timestamp":0},"reload_bundle_issued":false,"status":"None"},"backup_and_restore_primaries":false,"controlled_rolling_restart_flag":false,"eai:acl":null,"indexing_ready_flag":true,"initialized_flag":true,"label":"splunk-stack1-cluster-master-0","last_check_restart_bundle_result":false,"last_dry_run_bundle":{"bundle_path":"","checksum":"","timestamp":0},"last_validated_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/0af7c0e95f313f7be3b0cb1d878df9a1-1583948640.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","is_valid_bundle":true,"timestamp":1583948640},"latest_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7337-1583870198.bundle","checksum":"14310A4AABD23E85BBD4559C4A3B59F8","timestamp":1583870198},"maintenance_mode":false,"multisite":false,"previous_active_bundle":{"bundle_path":"","checksum":"","timestamp":0},"primaries_backup_status":"No on-going (or) completed primaries backup yet. Check back again in few minutes if you expect a backup.","quiet_period_flag":false,"rolling_restart_flag":false,"rolling_restart_or_upgrade":false,"service_ready_flag":true,"start_time":1583948636,"summary_replication":"false"}}],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/indexer_cluster_pod_manager_info.json + TestIndexerClusterPodManagerInfo string - //TestIndexerClusterPodManagerPeer - TestIndexerClusterPodManagerPeer = `{"links":{"create":"/services/cluster/master/peers/_new"},"origin":"https://localhost:8089/services/cluster/master/peers","updated":"2020-03-18T01:08:53+00:00","generator":{"build":"a7f645ddaf91","version":"8.0.2"},"entry":[{"name":"D39B1729-E2C5-4273-B9B2-534DA7C2F866","id":"https://localhost:8089/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","list":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866","edit":"/services/cluster/master/peers/D39B1729-E2C5-4273-B9B2-534DA7C2F866"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"active_bundle_id":"14310A4AABD23E85BBD4559C4A3B59F8","apply_bundle_status":{"invalid_bundle":{"bundle_validation_errors":[],"invalid_bundle_id":""},"reasons_for_restart":[],"restart_required_for_apply_bundle":false,"status":"None"},"base_generation_id":26,"bucket_count":73,"bucket_count_by_index":{"_audit":24,"_internal":45,"_telemetry":4},"buckets_rf_by_origin_site":{"default":73},"buckets_sf_by_origin_site":{"default":73},"delayed_buckets_to_discard":[],"eai:acl":null,"fixup_set":[],"heartbeat_started":true,"host_port_pair":"10.36.0.6:8089","indexing_disk_space":210707374080,"is_searchable":true,"is_valid_bundle":true,"label":"splunk-stack1-indexer-0","last_dry_run_bundle":"","last_heartbeat":1584493732,"last_validated_bundle":"14310A4AABD23E85BBD4559C4A3B59F8","latest_bundle_id":"14310A4AABD23E85BBD4559C4A3B59F8","peer_registered_summaries":true,"pending_builds":[],"pending_job_count":0,"primary_count":73,"primary_count_remote":0,"register_search_address":"10.36.0.6:8089","replication_count":0,"replication_port":9887,"replication_use_ssl":false,"restart_required_for_applying_dry_run_bundle":false,"search_state_counter":{"PendingSearchable":0,"Searchable":73,"SearchablePendingMask":0,"Unsearchable":0},"site":"default","splunk_version":"8.0.2","status":"Up","status_counter":{"Complete":69,"NonStreamingTarget":0,"StreamingSource":4,"StreamingTarget":0},"summary_replication_count":0}}],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/indexer_cluster_pod_manager_peer.json + TestIndexerClusterPodManagerPeer string - //TestGetIndexerStatefulSettest0 - TestGetIndexerStatefulSettest0 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-indexer","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-indexer-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_indexer"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-manager1-cluster-manager-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-indexer"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-indexer-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_indexer_stateful_settest0.json + TestGetIndexerStatefulSettest0 string - //TestGetIndexerStatefulSettest1 - TestGetIndexerStatefulSettest1 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-indexer","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-indexer-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_indexer"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-manager1-cluster-manager-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-indexer"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-indexer-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_indexer_stateful_settest1.json + TestGetIndexerStatefulSettest1 string - //TestGetIndexerStatefulSettest2 - TestGetIndexerStatefulSettest2 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-indexer","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-indexer-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"},{"name":"user-defined","containerPort":32000,"protocol":"UDP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_indexer"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-manager1-cluster-manager-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-indexer"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-indexer-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_indexer_stateful_settest2.json + TestGetIndexerStatefulSettest2 string - //TestGetIndexerStatefulSettest3 - TestGetIndexerStatefulSettest3 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-indexer","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-indexer-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"},{"name":"user-defined","containerPort":32000,"protocol":"UDP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_indexer"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-manager1-cluster-manager-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-indexer"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-indexer-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_indexer_stateful_settest3.json + TestGetIndexerStatefulSettest3 string - //TestGetIndexerStatefulSettest4 - TestGetIndexerStatefulSettest4 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-indexer","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-indexer-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"},{"name":"user-defined","containerPort":32000,"protocol":"UDP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_indexer"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-manager1-cluster-manager-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-indexer"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-indexer-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_indexer_stateful_settest4.json + TestGetIndexerStatefulSettest4 string - //TestGetIndexerStatefulSettest5 - TestGetIndexerStatefulSettest5 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-indexer","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-indexer-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"},{"name":"user-defined","containerPort":32000,"protocol":"UDP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_indexer"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-manager1-cluster-manager-service"},{"name":"TEST_ENV_VAR","value":"test_value"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-indexer"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-stack1-indexer","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"indexer","app.kubernetes.io/part-of":"splunk-manager1-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-indexer-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_indexer_stateful_settest5.json + TestGetIndexerStatefulSettest5 string - //TestMCApplyChanges - TestMCApplyChanges = `{"links":{"create":"/services/search/distributed/peers/_new","_reload":"/services/search/distributed/peers/_reload"},"origin":"https://localhost:8089/services/search/distributed/peers","updated":"2020-09-22T21:43:33+00:00","generator":{"build":"a1a6394cc5ae","version":"8.0.5"},"entry":[{"name":"splunk-example-cluster-master-service:8089","id":"https://localhost:8089/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089","list":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089","_reload":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089/_reload","edit":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089","remove":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089","disable":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089/disable","quarantine":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089/quarantine"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"build":"a1a6394cc5ae","bundle_isIndexing":["15065687072217053252 - false","16923722576385601869 - false","8527338655074501134 - false","5466829646820181037 - false","12887664000706842849 - false"],"bundle_versions":["15065687072217053252","16923722576385601869","8527338655074501134","5466829646820181037","12887664000706842849"],"cluster_label":["idxc_label"],"cpu_arch":"x86_64","disabled":false,"eai:acl":null,"enableRFSMonitoring":false,"guid":"19F5CA13-A561-4D1B-9341-A7BFC3E92F06","host":"splunk-example-cluster-master-0","host_fqdn":"splunk-example-cluster-master-0","isForwarding":true,"is_https":true,"licenseSignature":"c2bf3f573bbaf36ae13f326762945905","numberOfCores":"1","numberOfVirtualCores":"2","os_build":"#1 SMP Thu Sep 3 19:04:44 UTC 2020","os_name":"Linux","os_version":"4.14.193-149.317.amzn2.x86_64","peerName":"splunk-example-cluster-master-0","peerType":"configured","physicalMemoryMB":"7764","remote_session":"2bOC3nPGg_s2UREElAhLcKFXxuMNgwasCQPJG^tlXJ5LMzX1aCC8zwgWN2dCtUD2TyQ1szY0sdQhOwJyK_Igj6JUfEmcVGrsd3BtBvFOb0R_6F9kYRzHKz3","replicationStatus":"Successful","rtsearch_enabled":true,"search_groups":["dmc_group_cluster_master","dmc_group_license_master","dmc_indexerclustergroup_idxc_label"],"searchable_indexes":["_audit","_internal","_introspection","_metrics","_metrics_rollup","_telemetry","_thefishbucket","history","main","summary"],"server_roles":["license_master","cluster_master","search_head"],"shcluster_label":"","startup_time":1600810341,"status":"Up","status_details":[],"version":"8.0.5"}}],"paging":{"total":4,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/mc_apply_changes.json + TestMCApplyChanges string - //TestGetMCAssetTable - TestGetMCAssetTable = `{"links":{"create":"/services/search/distributed/peers/_new","_reload":"/services/search/distributed/peers/_reload"},"origin":"https://localhost:8089/services/search/distributed/peers","updated":"2020-09-22T21:43:33+00:00","generator":{"build":"a1a6394cc5ae","version":"8.0.5"},"entry":[{"name":"splunk-example-cluster-master-service:8089","id":"https://localhost:8089/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089","list":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089","_reload":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089/_reload","edit":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089","remove":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089","disable":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089/disable","quarantine":"/services/search/distributed/peers/splunk-example-cluster-master-service%3A8089/quarantine"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"build":"a1a6394cc5ae","bundle_isIndexing":["15065687072217053252 - false","16923722576385601869 - false","8527338655074501134 - false","5466829646820181037 - false","12887664000706842849 - false"],"bundle_versions":["15065687072217053252","16923722576385601869","8527338655074501134","5466829646820181037","12887664000706842849"],"cluster_label":["idxc_label"],"cpu_arch":"x86_64","disabled":false,"eai:acl":null,"enableRFSMonitoring":false,"guid":"19F5CA13-A561-4D1B-9341-A7BFC3E92F06","host":"splunk-example-cluster-master-0","host_fqdn":"splunk-example-cluster-master-0","isForwarding":true,"is_https":true,"licenseSignature":"c2bf3f573bbaf36ae13f326762945905","numberOfCores":"1","numberOfVirtualCores":"2","os_build":"#1 SMP Thu Sep 3 19:04:44 UTC 2020","os_name":"Linux","os_version":"4.14.193-149.317.amzn2.x86_64","peerName":"splunk-example-cluster-master-0","peerType":"configured","physicalMemoryMB":"7764","remote_session":"2bOC3nPGg_s2UREElAhLcKFXxuMNgwasCQPJG^tlXJ5LMzX1aCC8zwgWN2dCtUD2TyQ1szY0sdQhOwJyK_Igj6JUfEmcVGrsd3BtBvFOb0R_6F9kYRzHKz3","replicationStatus":"Successful","rtsearch_enabled":true,"search_groups":["dmc_group_cluster_master","dmc_group_license_master","dmc_indexerclustergroup_idxc_label"],"searchable_indexes":["_audit","_internal","_introspection","_metrics","_metrics_rollup","_telemetry","_thefishbucket","history","main","summary"],"server_roles":["license_master","cluster_master","search_head"],"shcluster_label":"","startup_time":1600810341,"status":"Up","status_details":[],"version":"8.0.5"}}],"paging":{"total":4,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/get_mc_asset_table.json + TestGetMCAssetTable string - //TestGetClusterInfo - TestGetClusterInfo = `{"links":{},"origin":"https://localhost:8089/services/server/info","updated":"2020-09-24T06:38:53+00:00","generator":{"build":"a1a6394cc5ae","version":"8.0.5"},"entry":[{"name":"server-info","id":"https://localhost:8089/services/server/info/server-info","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/server/info/server-info","list":"/services/server/info/server-info"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["*"],"write":[]},"removable":false,"sharing":"system"},"fields":{"required":[],"optional":[],"wildcard":[]},"content":{"activeLicenseGroup":"Trial","activeLicenseSubgroup":"Production","build":"a1a6394cc5ae","cluster_label":["idxc_label"],"cpu_arch":"x86_64","eai:acl":null,"fips_mode":false,"guid":"0F93F33C-4BDA-4A74-AD9F-3FCE26C6AFF0","health_info":"green","health_version":1,"host":"splunk-default-monitoring-console-86bc9b7c8c-d96x2","host_fqdn":"splunk-default-monitoring-console-86bc9b7c8c-d96x2","host_resolved":"splunk-default-monitoring-console-86bc9b7c8c-d96x2","isForwarding":true,"isFree":false,"isTrial":true,"kvStoreStatus":"ready","licenseKeys":["5C52DA5145AD67B8188604C49962D12F2C3B2CF1B82A6878E46F68CA2812807B"],"licenseSignature":"139bf73ec92c84121c79a9b8307a6724","licenseState":"OK","license_labels":["Splunk Enterprise Splunk Analytics for Hadoop Download Trial"],"master_guid":"0F93F33C-4BDA-4A74-AD9F-3FCE26C6AFF0","master_uri":"self","max_users":4294967295,"mode":"normal","numberOfCores":1,"numberOfVirtualCores":2,"os_build":"#1 SMP Thu Sep 3 19:04:44 UTC 2020","os_name":"Linux","os_name_extended":"Linux","os_version":"4.14.193-149.317.amzn2.x86_64","physicalMemoryMB":7764,"product_type":"enterprise","rtsearch_enabled":true,"serverName":"splunk-default-monitoring-console-86bc9b7c8c-d96x2","server_roles":["license_master","cluster_search_head","search_head"],"startup_time":1600928786,"staticAssetId":"CFE3D41EE2CCD1465E8C8453F83E4ECFFF540780B4490E84458DD4A3694CE4D1","version":"8.0.5"}}],"paging":{"total":1,"perPage":30,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/get_cluster_info.json + TestGetClusterInfo string - //TestGetLMStatefulSetT1 - TestGetLMStatefulSetT1 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-license-manager","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-license-manager-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_license_master"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-license-manager"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-license-manager-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_lm_stateful_set_t1.json + TestGetLMStatefulSetT1 string - //TestGetLMStatefulSetT2 - TestGetLMStatefulSetT2 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-license-manager","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-license-manager-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_license_master"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_LICENSE_URI","value":"/mnt/splunk.lic"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-license-manager"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-license-manager-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_lm_stateful_set_t2.json + TestGetLMStatefulSetT2 string - //TestGetLMStatefulSetT3 - TestGetLMStatefulSetT3 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-license-manager","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-license-manager-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_license_master"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_LICENSE_URI","value":"/mnt/splunk.lic"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-license-manager"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-license-manager-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_lm_stateful_set_t3.json + TestGetLMStatefulSetT3 string - //TestGetLMStatefulSetT4 - TestGetLMStatefulSetT4 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-license-manager","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-license-manager-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_license_master"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_LICENSE_URI","value":"/mnt/splunk.lic"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-license-manager"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-license-manager-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_lm_stateful_set_t4.json + TestGetLMStatefulSetT4 string - //TestGetLMStatefulSetT5 - TestGetLMStatefulSetT5 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-license-manager","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-license-manager-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_license_master"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_LICENSE_URI","value":"/mnt/splunk.lic"},{"name":"TEST_ENV_VAR","value":"test_value"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-license-manager"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"license-manager","app.kubernetes.io/instance":"splunk-stack1-license-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"license-manager","app.kubernetes.io/part-of":"splunk-stack1-license-manager"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-license-manager-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_lm_stateful_set_t5.json + TestGetLMStatefulSetT5 string - //TestVerifyRFPeers - TestVerifyRFPeers = `{"links":{"_reload":"/services/cluster/config/_reload","_acl":"/services/cluster/config/_acl"},"origin":"https://localhost:8089/services/cluster/config","updated":"2020-10-28T21:37:07+00:00","generator":{"build":"152fb4b2bb96","version":"8.0.6"},"entry":[{"name":"config","id":"https://localhost:8089/services/cluster/config/config","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/config/config","list":"/services/cluster/config/config","_reload":"/services/cluster/config/config/_reload","edit":"/services/cluster/config/config","disable":"/services/cluster/config/config/disable"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"access_logging_for_heartbeats":false,"auto_rebalance_primaries":true,"buckets_to_summarize":"primaries","cluster_label":"idxc_label","cxn_timeout":60,"decommission_force_finish_idle_time":0,"decommission_force_timeout":180,"disabled":false,"eai:acl":null,"forwarderdata_rcv_port":0,"forwarderdata_use_ssl":false,"frozen_notifications_per_batch":10,"guid":"F643BA71-0D3C-4D63-A0BC-A1604AC928E3","heartbeat_period":18446744073709552000,"heartbeat_timeout":60,"master_uri":"https://127.0.0.1:8089","max_auto_service_interval":30,"max_fixup_time_ms":5000,"max_peer_build_load":2,"max_peer_rep_load":5,"max_peer_sum_rep_load":5,"max_peers_to_download_bundle":5,"max_primary_backups_per_service":10,"mode":"master","multisite":"false","notify_buckets_period":10,"notify_scan_min_period":10,"notify_scan_period":10,"percent_peers_to_restart":10,"ping_flag":true,"quiet_period":60,"rcv_timeout":60,"rebalance_primaries_execution_limit_ms":0,"rebalance_threshold":0.9,"register_forwarder_address":"","register_replication_address":"","register_search_address":"","remote_storage_upload_timeout":60,"rep_cxn_timeout":60,"rep_max_rcv_timeout":180,"rep_max_send_timeout":180,"rep_rcv_timeout":60,"rep_send_timeout":60,"replication_factor":3,"replication_port":null,"replication_use_ssl":false,"report_remote_storage_bucket_upload_to_targets":false,"reporting_delay_period":30,"restart_inactivity_timeout":600,"restart_timeout":60,"rolling_restart":"restart","search_factor":3,"search_files_retry_timeout":600,"secret":"********","send_timeout":60,"service_interval":0,"site":"default","site_by_site":true,"summary_replication":"false","use_batch_discard":"true","use_batch_mask_changes":"true","use_batch_remote_rep_changes":"false"}}],"paging":{"total":1,"perPage":10000000,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/verify_rf_peers.json + TestVerifyRFPeers string - //TestVerifyRFPeersMultiSite - TestVerifyRFPeersMultiSite = `{"links":{"_reload":"/services/cluster/config/_reload","_acl":"/services/cluster/config/_acl"},"origin":"https://localhost:8089/services/cluster/config","updated":"2020-10-28T21:37:07+00:00","generator":{"build":"152fb4b2bb96","version":"8.0.6"},"entry":[{"name":"config","id":"https://localhost:8089/services/cluster/config/config","updated":"1970-01-01T00:00:00+00:00","links":{"alternate":"/services/cluster/config/config","list":"/services/cluster/config/config","_reload":"/services/cluster/config/config/_reload","edit":"/services/cluster/config/config","disable":"/services/cluster/config/config/disable"},"author":"system","acl":{"app":"","can_list":true,"can_write":true,"modifiable":false,"owner":"system","perms":{"read":["admin","splunk-system-role"],"write":["admin","splunk-system-role"]},"removable":false,"sharing":"system"},"content":{"access_logging_for_heartbeats":false,"auto_rebalance_primaries":true,"buckets_to_summarize":"primaries","cluster_label":"idxc_label","cxn_timeout":60,"decommission_force_finish_idle_time":0,"decommission_force_timeout":180,"disabled":false,"eai:acl":null,"forwarderdata_rcv_port":0,"forwarderdata_use_ssl":false,"frozen_notifications_per_batch":10,"guid":"F643BA71-0D3C-4D63-A0BC-A1604AC928E3","heartbeat_period":18446744073709552000,"heartbeat_timeout":60,"master_uri":"https://127.0.0.1:8089","max_auto_service_interval":30,"max_fixup_time_ms":5000,"max_peer_build_load":2,"max_peer_rep_load":5,"max_peer_sum_rep_load":5,"max_peers_to_download_bundle":5,"max_primary_backups_per_service":10,"mode":"master","multisite":"true","notify_buckets_period":10,"notify_scan_min_period":10,"notify_scan_period":10,"percent_peers_to_restart":10,"ping_flag":true,"quiet_period":60,"rcv_timeout":60,"rebalance_primaries_execution_limit_ms":0,"rebalance_threshold":0.9,"register_forwarder_address":"","register_replication_address":"","register_search_address":"","remote_storage_upload_timeout":60,"rep_cxn_timeout":60,"rep_max_rcv_timeout":180,"rep_max_send_timeout":180,"rep_rcv_timeout":60,"rep_send_timeout":60,"replication_factor":3,"replication_port":null,"replication_use_ssl":false,"report_remote_storage_bucket_upload_to_targets":false,"reporting_delay_period":30,"restart_inactivity_timeout":600,"restart_timeout":60,"rolling_restart":"restart","search_factor":3,"search_files_retry_timeout":600,"secret":"********","send_timeout":60,"service_interval":0,"site":"site1","site_by_site":true,"site_replication_factor":"{ origin:2, total:2 }","site_search_factor":"{ origin:2, total:2 }","summary_replication":"false","use_batch_discard":"true","use_batch_mask_changes":"true","use_batch_remote_rep_changes":"false"}}],"paging":{"total":1,"perPage":10000000,"offset":0},"messages":[]}` + //go:embed testdata/fixtures/verify_rf_peers_multi_site.json + TestVerifyRFPeersMultiSite string - //TestGetStandaloneStatefulSetT1 - TestGetStandaloneStatefulSetT1 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-standalone","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"},"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"defaults"},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-standalone-secret-v1","defaultMode":420}},{"name":"mnt-splunk-defaults","configMap":{"name":"splunk-stack1-standalone-defaults","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_search_head"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack2-cluster-manager-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"defaults","mountPath":"/mnt/defaults"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"},{"name":"mnt-splunk-defaults","mountPath":"/mnt/splunk-defaults"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-standalone"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"custom-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}},"storageClassName":"gp2"},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}},"storageClassName":"gp2"},"status":{}}],"serviceName":"splunk-stack1-standalone-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_standalone_stateful_set_t1.json + TestGetStandaloneStatefulSetT1 string - //TestGetStandaloneStatefulSetT2 - TestGetStandaloneStatefulSetT2 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-standalone","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"defaults"},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-standalone-secret-v1","defaultMode":420}},{"name":"mnt-splunk-defaults","configMap":{"name":"splunk-stack1-standalone-defaults","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_search_head"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack2-cluster-manager-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"defaults","mountPath":"/mnt/defaults"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"},{"name":"mnt-splunk-defaults","mountPath":"/mnt/splunk-defaults"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-standalone"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"custom-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}},"storageClassName":"gp2"},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}},"storageClassName":"gp2"},"status":{}}],"serviceName":"splunk-stack1-standalone-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_standalone_stateful_set_t2.json + TestGetStandaloneStatefulSetT2 string - //TestGetStandaloneStatefulSetT3 - TestGetStandaloneStatefulSetT3 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-standalone","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"defaults"},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-standalone-secret-v1","defaultMode":420}},{"name":"mnt-splunk-defaults","configMap":{"name":"splunk-stack1-standalone-defaults","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_search_head"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack2-cluster-manager-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"defaults","mountPath":"/mnt/defaults"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"},{"name":"mnt-splunk-defaults","mountPath":"/mnt/splunk-defaults"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-standalone"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"custom-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}},"storageClassName":"gp2"},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}},"storageClassName":"gp2"},"status":{}}],"serviceName":"splunk-stack1-standalone-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_standalone_stateful_set_t3.json + TestGetStandaloneStatefulSetT3 string - //TestGetStandaloneStatefulSetT4 - TestGetStandaloneStatefulSetT4 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-standalone","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"},"annotations":{"traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"defaults"},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-standalone-secret-v1","defaultMode":420}},{"name":"mnt-splunk-defaults","configMap":{"name":"splunk-stack1-standalone-defaults","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_search_head"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack2-cluster-manager-service"},{"name":"TEST_ENV_VAR","value":"test_value"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"defaults","mountPath":"/mnt/defaults"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"},{"name":"mnt-splunk-defaults","mountPath":"/mnt/splunk-defaults"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-standalone"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"custom-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}},"storageClassName":"gp2"},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"standalone","app.kubernetes.io/instance":"splunk-stack1-standalone","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"standalone","app.kubernetes.io/part-of":"splunk-stack1-standalone"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}},"storageClassName":"gp2"},"status":{}}],"serviceName":"splunk-stack1-standalone-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_standalone_stateful_set_t4.json + TestGetStandaloneStatefulSetT4 string - //TestApplyAppListingConfigMap - TestApplyAppListingConfigMap = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-example-cluster-master","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"ClusterMaster","name":"example","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-example-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-example-indexer"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-example-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-example-indexer"},"annotations":{"appListingRev":"","traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000"}},"spec":{"volumes":[{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-example-cluster-master-secret-v1","defaultMode":420}},{"name":"mnt-app-listing","configMap":{"name":"splunk-example-clustermaster-app-list","items":[{"key":"app-list-cluster-with-pre-config.yaml","path":"app-list-cluster-with-pre-config.yaml","mode":420},{"key":"app-list-cluster.yaml","path":"app-list-cluster.yaml","mode":420},{"key":"app-list-local.yaml","path":"app-list-local.yaml","mode":420},{"key":"appsUpdateToken","path":"appsUpdateToken","mode":420}],"defaultMode":420}},{"name":"init-apps","emptyDir":{}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/app-listing/app-list-local.yaml,/mnt/app-listing/app-list-cluster.yaml,/mnt/app-listing/app-list-cluster-with-pre-config.yaml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_cluster_master"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"},{"name":"mnt-app-listing","mountPath":"/mnt/app-listing/"},{"name":"init-apps","mountPath":"/init-apps/"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":1800,"timeoutSeconds":30,"periodSeconds":30},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":16},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-example-cluster-master"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-example-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-example-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-example-cluster-master","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-master","app.kubernetes.io/part-of":"splunk-example-indexer"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-example-cluster-master-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"availableReplicas":0, "replicas":0}}` + //go:embed testdata/fixtures/apply_app_listing_config_map.json + TestApplyAppListingConfigMap string - //TestGetMonitoringConsoleStatefulSetT1 - TestGetMonitoringConsoleStatefulSetT1 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-monitoring-console","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"},"annotations":{"monitoringConsoleConfigRev":"","traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-monitoring-console-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"envFrom":[{"configMapRef":{"name":"splunk-stack1-monitoring-console"}}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_monitor"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-monitoring-console"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"splunk-stack1-monitoring-console-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_monitoring_console_stateful_set_t1.json + TestGetMonitoringConsoleStatefulSetT1 string - //TestGetMonitoringConsoleStatefulSetT2 - TestGetMonitoringConsoleStatefulSetT2 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-monitoring-console","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"},"annotations":{"monitoringConsoleConfigRev":"","traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"mnt-splunk-etc","emptyDir":{}},{"name":"mnt-splunk-var","emptyDir":{}},{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-monitoring-console-secret-v1","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"envFrom":[{"configMapRef":{"name":"splunk-stack1-monitoring-console"}}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_monitor"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"mnt-splunk-etc","mountPath":"/opt/splunk/etc"},{"name":"mnt-splunk-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-monitoring-console"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"default-scheduler"}},"serviceName":"splunk-stack1-monitoring-console-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_monitoring_console_stateful_set_t2.json + TestGetMonitoringConsoleStatefulSetT2 string - //TestGetMonitoringConsoleStatefulSetT3 - TestGetMonitoringConsoleStatefulSetT3 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-monitoring-console","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"},"annotations":{"monitoringConsoleConfigRev":"","traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"defaults"},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-monitoring-console-secret-v1","defaultMode":420}},{"name":"mnt-splunk-defaults","configMap":{"name":"splunk-stack1-monitoring-console-defaults","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"envFrom":[{"configMapRef":{"name":"splunk-stack1-monitoring-console"}}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_monitor"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack2-cluster-manager-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"defaults","mountPath":"/mnt/defaults"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"},{"name":"mnt-splunk-defaults","mountPath":"/mnt/splunk-defaults"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-monitoring-console"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"custom-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}},"storageClassName":"gp2"},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}},"storageClassName":"gp2"},"status":{}}],"serviceName":"splunk-stack1-monitoring-console-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_monitoring_console_stateful_set_t3.json + TestGetMonitoringConsoleStatefulSetT3 string - //TestGetMonitoringConsoleStatefulSetT4 - TestGetMonitoringConsoleStatefulSetT4 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-monitoring-console","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"},"annotations":{"monitoringConsoleConfigRev":"","traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"defaults"},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-monitoring-console-secret-v1","defaultMode":420}},{"name":"mnt-splunk-defaults","configMap":{"name":"splunk-stack1-monitoring-console-defaults","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"envFrom":[{"configMapRef":{"name":"splunk-stack1-monitoring-console"}}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_monitor"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack2-cluster-manager-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"defaults","mountPath":"/mnt/defaults"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"},{"name":"mnt-splunk-defaults","mountPath":"/mnt/splunk-defaults"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-monitoring-console"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"custom-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}},"storageClassName":"gp2"},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}},"storageClassName":"gp2"},"status":{}}],"serviceName":"splunk-stack1-monitoring-console-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_monitoring_console_stateful_set_t4.json + TestGetMonitoringConsoleStatefulSetT4 string - //TestGetMonitoringConsoleStatefulSetT5 - TestGetMonitoringConsoleStatefulSetT5 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-monitoring-console","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"},"annotations":{"monitoringConsoleConfigRev":"","traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"defaults"},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-monitoring-console-secret-v1","defaultMode":420}},{"name":"mnt-splunk-defaults","configMap":{"name":"splunk-stack1-monitoring-console-defaults","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"envFrom":[{"configMapRef":{"name":"splunk-stack1-monitoring-console"}}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_monitor"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack2-cluster-manager-service"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"defaults","mountPath":"/mnt/defaults"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"},{"name":"mnt-splunk-defaults","mountPath":"/mnt/splunk-defaults"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-monitoring-console"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"custom-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}},"storageClassName":"gp2"},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}},"storageClassName":"gp2"},"status":{}}],"serviceName":"splunk-stack1-monitoring-console-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_monitoring_console_stateful_set_t5.json + TestGetMonitoringConsoleStatefulSetT5 string - //TestGetMonitoringConsoleStatefulSetT6 - TestGetMonitoringConsoleStatefulSetT6 = `{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"splunk-stack1-monitoring-console","namespace":"test","creationTimestamp":null,"ownerReferences":[{"apiVersion":"","kind":"","name":"stack1","uid":"","controller":true}]},"spec":{"replicas":1,"selector":{"matchLabels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"template":{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"},"annotations":{"monitoringConsoleConfigRev":"","traffic.sidecar.istio.io/excludeOutboundPorts":"8089,8191,9997","traffic.sidecar.istio.io/includeInboundPorts":"8000,8088"}},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}},{"name":"defaults"},{"name":"mnt-splunk-secrets","secret":{"secretName":"splunk-stack1-monitoring-console-secret-v1","defaultMode":420}},{"name":"mnt-splunk-defaults","configMap":{"name":"splunk-stack1-monitoring-console-defaults","defaultMode":420}}],"containers":[{"name":"splunk","image":"splunk/splunk","ports":[{"name":"http-splunkweb","containerPort":8000,"protocol":"TCP"},{"name":"http-hec","containerPort":8088,"protocol":"TCP"},{"name":"https-splunkd","containerPort":8089,"protocol":"TCP"},{"name":"tcp-s2s","containerPort":9997,"protocol":"TCP"}],"envFrom":[{"configMapRef":{"name":"splunk-stack1-monitoring-console"}}],"env":[{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"localhost"},{"name":"SPLUNK_HOME","value":"/opt/splunk"},{"name":"SPLUNK_START_ARGS","value":"--accept-license"},{"name":"SPLUNK_DEFAULTS_URL","value":"/mnt/splunk-defaults/default.yml,/mnt/defaults/defaults.yml,/mnt/apps/apps.yml,/mnt/splunk-secrets/default.yml"},{"name":"SPLUNK_HOME_OWNERSHIP_ENFORCEMENT","value":"false"},{"name":"SPLUNK_ROLE","value":"splunk_monitor"},{"name":"SPLUNK_DECLARATIVE_ADMIN_PASSWORD","value":"true"},{"name":"SPLUNK_OPERATOR_K8_LIVENESS_DRIVER_FILE_PATH","value":"/tmp/splunk_operator_k8s/probes/k8_liveness_driver.sh"},{"name":"SPLUNK_CLUSTER_MASTER_URL","value":"splunk-stack2-cluster-manager-service"},{"name":"TEST_ENV_VAR","value":"test_value"}],"resources":{"limits":{"cpu":"4","memory":"8Gi"},"requests":{"cpu":"100m","memory":"512Mi"}},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"},{"name":"defaults","mountPath":"/mnt/defaults"},{"name":"mnt-splunk-secrets","mountPath":"/mnt/splunk-secrets"},{"name":"mnt-splunk-defaults","mountPath":"/mnt/splunk-defaults"}],"livenessProbe":{"exec":{"command":["/mnt/probes/livenessProbe.sh"]},"initialDelaySeconds":30,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":3},"readinessProbe":{"exec":{"command":["/mnt/probes/readinessProbe.sh"]},"initialDelaySeconds":10,"timeoutSeconds":5,"periodSeconds":5,"failureThreshold":3},"startupProbe":{"exec":{"command":["/mnt/probes/startupProbe.sh"]},"initialDelaySeconds":40,"timeoutSeconds":30,"periodSeconds":30,"failureThreshold":12},"imagePullPolicy":"IfNotPresent"}],"serviceAccountName":"defaults","securityContext":{"runAsUser":41812,"runAsNonRoot":true,"fsGroup":41812,"fsGroupChangePolicy": "OnRootMismatch"},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":100,"podAffinityTerm":{"labelSelector":{"matchExpressions":[{"key":"app.kubernetes.io/instance","operator":"In","values":["splunk-stack1-monitoring-console"]}]},"topologyKey":"kubernetes.io/hostname"}}]}},"schedulerName":"custom-scheduler"}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}},"storageClassName":"gp2"},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null,"labels":{"app.kubernetes.io/component":"monitoring-console","app.kubernetes.io/instance":"splunk-stack1-monitoring-console","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"monitoring-console","app.kubernetes.io/part-of":"splunk-stack1-monitoring-console"}},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}},"storageClassName":"gp2"},"status":{}}],"serviceName":"splunk-stack1-monitoring-console-headless","podManagementPolicy":"Parallel","updateStrategy":{"type":"OnDelete"}},"status":{"replicas":0,"availableReplicas":0}}` + //go:embed testdata/fixtures/get_monitoring_console_stateful_set_t6.json + TestGetMonitoringConsoleStatefulSetT6 string ) diff --git a/pkg/splunk/enterprise/configuration_test.go b/pkg/splunk/enterprise/configuration_test.go index 2c92e3ec4..274be1470 100644 --- a/pkg/splunk/enterprise/configuration_test.go +++ b/pkg/splunk/enterprise/configuration_test.go @@ -1357,7 +1357,7 @@ func TestAddStorageVolumes(t *testing.T) { } // Test defaults - PVCs for etc & var with 10Gi and 100Gi storage capacity - test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"test-statefulset","namespace":"test","creationTimestamp":null},"spec":{"replicas":1,"selector":null,"template":{"metadata":{"creationTimestamp":null},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}}],"containers":[{"name":"splunk","image":"test","resources":{},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"}]}]}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}}},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"100Gi"}}},"status":{}}],"serviceName":"","updateStrategy":{}},"status":{"replicas":0,"availableReplicas":0}}`) + test(loadFixture(t, "add_storage_volumes_default.json")) // Define PVCs for etc & var with storage capacity and storage class name defined spec = &enterpriseApi.CommonSplunkSpec{ EtcVolumeStorageConfig: enterpriseApi.StorageClassSpec{ @@ -1369,7 +1369,7 @@ func TestAddStorageVolumes(t *testing.T) { StorageClassName: "gp3", }, } - test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"test-statefulset","namespace":"test","creationTimestamp":null},"spec":{"replicas":1,"selector":null,"template":{"metadata":{"creationTimestamp":null},"spec":{"volumes":[{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}}],"containers":[{"name":"splunk","image":"test","resources":{},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"}]}]}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"25Gi"}},"storageClassName":"gp2"},"status":{}},{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"35Gi"}},"storageClassName":"gp3"},"status":{}}],"serviceName":"","updateStrategy":{}},"status":{"replicas":0,"availableReplicas":0}}`) + test(loadFixture(t, "add_storage_volumes_custom_storage.json")) // Define PVCs for etc & ephemeral for var spec = &enterpriseApi.CommonSplunkSpec{ EtcVolumeStorageConfig: enterpriseApi.StorageClassSpec{ @@ -1380,7 +1380,7 @@ func TestAddStorageVolumes(t *testing.T) { EphemeralStorage: true, }, } - test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"test-statefulset","namespace":"test","creationTimestamp":null},"spec":{"replicas":1,"selector":null,"template":{"metadata":{"creationTimestamp":null},"spec":{"volumes":[{"name":"mnt-splunk-var","emptyDir":{}},{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}}],"containers":[{"name":"splunk","image":"test","resources":{},"volumeMounts":[{"name":"pvc-etc","mountPath":"/opt/splunk/etc"},{"name":"mnt-splunk-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"}]}]}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-etc","namespace":"test","creationTimestamp":null},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"25Gi"}},"storageClassName":"gp2"},"status":{}}],"serviceName":"","updateStrategy":{}},"status":{"replicas":0,"availableReplicas":0}}`) + test(loadFixture(t, "add_storage_volumes_ephemeral_var.json")) // Define ephemeral for etc & PVCs for var spec = &enterpriseApi.CommonSplunkSpec{ EtcVolumeStorageConfig: enterpriseApi.StorageClassSpec{ @@ -1391,7 +1391,7 @@ func TestAddStorageVolumes(t *testing.T) { StorageClassName: "gp2", }, } - test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"test-statefulset","namespace":"test","creationTimestamp":null},"spec":{"replicas":1,"selector":null,"template":{"metadata":{"creationTimestamp":null},"spec":{"volumes":[{"name":"mnt-splunk-etc","emptyDir":{}},{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}}],"containers":[{"name":"splunk","image":"test","resources":{},"volumeMounts":[{"name":"mnt-splunk-etc","mountPath":"/opt/splunk/etc"},{"name":"pvc-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"}]}]}},"volumeClaimTemplates":[{"metadata":{"name":"pvc-var","namespace":"test","creationTimestamp":null},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"25Gi"}},"storageClassName":"gp2"},"status":{}}],"serviceName":"","updateStrategy":{}},"status":{"replicas":0,"availableReplicas":0}}`) + test(loadFixture(t, "add_storage_volumes_ephemeral_etc.json")) // Define ephemeral for etc & var(should ignore storage capacity & storage class name) spec = &enterpriseApi.CommonSplunkSpec{ EtcVolumeStorageConfig: enterpriseApi.StorageClassSpec{ @@ -1403,7 +1403,7 @@ func TestAddStorageVolumes(t *testing.T) { StorageClassName: "gp2", }, } - test(`{"kind":"StatefulSet","apiVersion":"apps/v1","metadata":{"name":"test-statefulset","namespace":"test","creationTimestamp":null},"spec":{"replicas":1,"selector":null,"template":{"metadata":{"creationTimestamp":null},"spec":{"volumes":[{"name":"mnt-splunk-etc","emptyDir":{}},{"name":"mnt-splunk-var","emptyDir":{}},{"name":"splunk-test-probe-configmap","configMap":{"name":"splunk-test-probe-configmap","defaultMode":365}}],"containers":[{"name":"splunk","image":"test","resources":{},"volumeMounts":[{"name":"mnt-splunk-etc","mountPath":"/opt/splunk/etc"},{"name":"mnt-splunk-var","mountPath":"/opt/splunk/var"},{"name":"splunk-test-probe-configmap","mountPath":"/mnt/probes"}]}]}},"serviceName":"","updateStrategy":{}},"status":{"replicas":0,"availableReplicas":0}}`) + test(loadFixture(t, "add_storage_volumes_ephemeral_both.json")) // Define invalid EtcVolumeStorageConfig spec = &enterpriseApi.CommonSplunkSpec{ EtcVolumeStorageConfig: enterpriseApi.StorageClassSpec{ @@ -1487,7 +1487,7 @@ func TestAddStorageVolumes(t *testing.T) { }, } - test(`{"apiVersion":"apps/v1","kind":"StatefulSet","metadata":{"annotations":{"enterprise.splunk.com/admin-managed-pv":"true"},"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-CM-cluster-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-manager"},"name":"test-statefulset","namespace":"test"},"spec":{"replicas":1,"selector":null,"serviceName":"","template":{"metadata":{"creationTimestamp":null},"spec":{"containers":[{"image":"test","name":"splunk","resources":{},"volumeMounts":[{"mountPath":"/opt/splunk/etc","name":"pvc-etc"},{"mountPath":"/opt/splunk/var","name":"pvc-var"},{"mountPath":"/mnt/probes","name":"splunk-test-probe-configmap"}]}],"volumes":[{"configMap":{"defaultMode":365,"name":"splunk-test-probe-configmap"},"name":"splunk-test-probe-configmap"}]}},"updateStrategy":{},"volumeClaimTemplates":[{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-CM-cluster-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-manager"},"name":"pvc-etc","namespace":"test"},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"35Gi"}},"selector":{"matchLabels":{"app.kubernetes.io/instance":"splunk-CM-cluster-manager","app.kubernetes.io/name":"cluster-manager"}}},"status":{}},{"metadata":{"creationTimestamp":null,"labels":{"app.kubernetes.io/component":"indexer","app.kubernetes.io/instance":"splunk-CM-cluster-manager","app.kubernetes.io/managed-by":"splunk-operator","app.kubernetes.io/name":"cluster-manager"},"name":"pvc-var","namespace":"test"},"spec":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"25Gi"}},"selector":{"matchLabels":{"app.kubernetes.io/instance":"splunk-CM-cluster-manager","app.kubernetes.io/name":"cluster-manager"}}},"status":{}}]},"status":{"availableReplicas":0,"replicas":0}}`) + test(loadFixture(t, "add_storage_volumes_admin_managed_pv.json")) } func TestGetVolumeSourceMountFromConfigMapData(t *testing.T) { @@ -1509,7 +1509,7 @@ func TestGetVolumeSourceMountFromConfigMapData(t *testing.T) { } - test(cm, &mode, `{"configMap":{"name":"testConfgMap","items":[{"key":"a","path":"a","mode":755},{"key":"b","path":"b","mode":755},{"key":"z","path":"z","mode":755}],"defaultMode":755}}`) + test(cm, &mode, loadFixture(t, "get_volume_source_mount_from_configmap.json")) } func TestGetLivenessProbe(t *testing.T) { @@ -1593,7 +1593,7 @@ func TestGetProbe(t *testing.T) { } - test(command, 100, 10, 10, `{"exec":{"command":["grep","ready","file.txt"]},"initialDelaySeconds":100,"timeoutSeconds":10,"periodSeconds":10}`) + test(command, 100, 10, 10, loadFixture(t, "get_probe.json")) } func TestCreateOrUpdateAppUpdateConfigMapShouldNotFail(t *testing.T) { diff --git a/pkg/splunk/enterprise/indexercluster_test.go b/pkg/splunk/enterprise/indexercluster_test.go index a628a5619..6099336bc 100644 --- a/pkg/splunk/enterprise/indexercluster_test.go +++ b/pkg/splunk/enterprise/indexercluster_test.go @@ -3085,7 +3085,7 @@ func TestClusterQuorumLostEvent(t *testing.T) { // Reset recorder and prepare second call with indexing_ready=false recorder.events = []mockEvent{} - quorumLostInfo := `{"entry":[{"content":{"initialized_flag":true,"indexing_ready_flag":false,"service_ready_flag":true,"maintenance_mode":false,"rolling_restart_flag":false,"label":"splunk-manager1-cluster-manager-0","active_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7571-1583870198.bundle","checksum":"ABC123","timestamp":1583870198},"latest_bundle":{"bundle_path":"/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7571-1583870198.bundle","checksum":"ABC123","timestamp":1583870198},"multisite":"false","replication_factor":3,"site_replication_factor":"origin:2,total:3"}}]}` + quorumLostInfo := loadFixture(t, "quorum_lost_info.json") quorumLostHandlers := []spltest.MockHTTPHandler{ {Method: "GET", URL: "https://splunk-manager1-cluster-manager-service.test.svc.cluster.local:8089/services/cluster/manager/info?count=0&output_mode=json", Status: 200, Body: quorumLostInfo}, {Method: "GET", URL: "https://splunk-manager1-cluster-manager-service.test.svc.cluster.local:8089/services/cluster/manager/peers?count=0&output_mode=json", Status: 200, Body: splcommon.TestIndexerClusterPodManagerPeer}, diff --git a/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_admin_managed_pv.json b/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_admin_managed_pv.json new file mode 100644 index 000000000..c802fed29 --- /dev/null +++ b/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_admin_managed_pv.json @@ -0,0 +1,127 @@ +{ + "apiVersion": "apps/v1", + "kind": "StatefulSet", + "metadata": { + "annotations": { + "enterprise.splunk.com/admin-managed-pv": "true" + }, + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-CM-cluster-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-manager" + }, + "name": "test-statefulset", + "namespace": "test" + }, + "spec": { + "replicas": 1, + "selector": null, + "serviceName": "", + "template": { + "metadata": { + "creationTimestamp": null + }, + "spec": { + "containers": [ + { + "image": "test", + "name": "splunk", + "resources": {}, + "volumeMounts": [ + { + "mountPath": "/opt/splunk/etc", + "name": "pvc-etc" + }, + { + "mountPath": "/opt/splunk/var", + "name": "pvc-var" + }, + { + "mountPath": "/mnt/probes", + "name": "splunk-test-probe-configmap" + } + ] + } + ], + "volumes": [ + { + "configMap": { + "defaultMode": 365, + "name": "splunk-test-probe-configmap" + }, + "name": "splunk-test-probe-configmap" + } + ] + } + }, + "updateStrategy": {}, + "volumeClaimTemplates": [ + { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-CM-cluster-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-manager" + }, + "name": "pvc-etc", + "namespace": "test" + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "35Gi" + } + }, + "selector": { + "matchLabels": { + "app.kubernetes.io/instance": "splunk-CM-cluster-manager", + "app.kubernetes.io/name": "cluster-manager" + } + } + }, + "status": {} + }, + { + "metadata": { + "creationTimestamp": null, + "labels": { + "app.kubernetes.io/component": "indexer", + "app.kubernetes.io/instance": "splunk-CM-cluster-manager", + "app.kubernetes.io/managed-by": "splunk-operator", + "app.kubernetes.io/name": "cluster-manager" + }, + "name": "pvc-var", + "namespace": "test" + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "25Gi" + } + }, + "selector": { + "matchLabels": { + "app.kubernetes.io/instance": "splunk-CM-cluster-manager", + "app.kubernetes.io/name": "cluster-manager" + } + } + }, + "status": {} + } + ] + }, + "status": { + "availableReplicas": 0, + "replicas": 0 + } +} diff --git a/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_custom_storage.json b/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_custom_storage.json new file mode 100644 index 000000000..ad136b538 --- /dev/null +++ b/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_custom_storage.json @@ -0,0 +1,96 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "test-statefulset", + "namespace": "test", + "creationTimestamp": null + }, + "spec": { + "replicas": 1, + "selector": null, + "template": { + "metadata": { + "creationTimestamp": null + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "test", + "resources": {}, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + } + ] + } + ] + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "25Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "35Gi" + } + }, + "storageClassName": "gp3" + }, + "status": {} + } + ], + "serviceName": "", + "updateStrategy": {} + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_default.json b/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_default.json new file mode 100644 index 000000000..dfc98eb2d --- /dev/null +++ b/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_default.json @@ -0,0 +1,94 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "test-statefulset", + "namespace": "test", + "creationTimestamp": null + }, + "spec": { + "replicas": 1, + "selector": null, + "template": { + "metadata": { + "creationTimestamp": null + }, + "spec": { + "volumes": [ + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "test", + "resources": {}, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + } + ] + } + ] + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "10Gi" + } + } + }, + "status": {} + }, + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "100Gi" + } + } + }, + "status": {} + } + ], + "serviceName": "", + "updateStrategy": {} + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_ephemeral_both.json b/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_ephemeral_both.json new file mode 100644 index 000000000..599fd3d4c --- /dev/null +++ b/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_ephemeral_both.json @@ -0,0 +1,64 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "test-statefulset", + "namespace": "test", + "creationTimestamp": null + }, + "spec": { + "replicas": 1, + "selector": null, + "template": { + "metadata": { + "creationTimestamp": null + }, + "spec": { + "volumes": [ + { + "name": "mnt-splunk-etc", + "emptyDir": {} + }, + { + "name": "mnt-splunk-var", + "emptyDir": {} + }, + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "test", + "resources": {}, + "volumeMounts": [ + { + "name": "mnt-splunk-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "mnt-splunk-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + } + ] + } + ] + } + }, + "serviceName": "", + "updateStrategy": {} + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_ephemeral_etc.json b/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_ephemeral_etc.json new file mode 100644 index 000000000..7dfb7b9c7 --- /dev/null +++ b/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_ephemeral_etc.json @@ -0,0 +1,81 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "test-statefulset", + "namespace": "test", + "creationTimestamp": null + }, + "spec": { + "replicas": 1, + "selector": null, + "template": { + "metadata": { + "creationTimestamp": null + }, + "spec": { + "volumes": [ + { + "name": "mnt-splunk-etc", + "emptyDir": {} + }, + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "test", + "resources": {}, + "volumeMounts": [ + { + "name": "mnt-splunk-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "pvc-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + } + ] + } + ] + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-var", + "namespace": "test", + "creationTimestamp": null + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "25Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + } + ], + "serviceName": "", + "updateStrategy": {} + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_ephemeral_var.json b/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_ephemeral_var.json new file mode 100644 index 000000000..df9a33fb7 --- /dev/null +++ b/pkg/splunk/enterprise/testdata/fixtures/add_storage_volumes_ephemeral_var.json @@ -0,0 +1,81 @@ +{ + "kind": "StatefulSet", + "apiVersion": "apps/v1", + "metadata": { + "name": "test-statefulset", + "namespace": "test", + "creationTimestamp": null + }, + "spec": { + "replicas": 1, + "selector": null, + "template": { + "metadata": { + "creationTimestamp": null + }, + "spec": { + "volumes": [ + { + "name": "mnt-splunk-var", + "emptyDir": {} + }, + { + "name": "splunk-test-probe-configmap", + "configMap": { + "name": "splunk-test-probe-configmap", + "defaultMode": 365 + } + } + ], + "containers": [ + { + "name": "splunk", + "image": "test", + "resources": {}, + "volumeMounts": [ + { + "name": "pvc-etc", + "mountPath": "/opt/splunk/etc" + }, + { + "name": "mnt-splunk-var", + "mountPath": "/opt/splunk/var" + }, + { + "name": "splunk-test-probe-configmap", + "mountPath": "/mnt/probes" + } + ] + } + ] + } + }, + "volumeClaimTemplates": [ + { + "metadata": { + "name": "pvc-etc", + "namespace": "test", + "creationTimestamp": null + }, + "spec": { + "accessModes": [ + "ReadWriteOnce" + ], + "resources": { + "requests": { + "storage": "25Gi" + } + }, + "storageClassName": "gp2" + }, + "status": {} + } + ], + "serviceName": "", + "updateStrategy": {} + }, + "status": { + "replicas": 0, + "availableReplicas": 0 + } +} diff --git a/pkg/splunk/enterprise/testdata/fixtures/get_probe.json b/pkg/splunk/enterprise/testdata/fixtures/get_probe.json new file mode 100644 index 000000000..42c260e27 --- /dev/null +++ b/pkg/splunk/enterprise/testdata/fixtures/get_probe.json @@ -0,0 +1,12 @@ +{ + "exec": { + "command": [ + "grep", + "ready", + "file.txt" + ] + }, + "initialDelaySeconds": 100, + "timeoutSeconds": 10, + "periodSeconds": 10 +} diff --git a/pkg/splunk/enterprise/testdata/fixtures/get_volume_source_mount_from_configmap.json b/pkg/splunk/enterprise/testdata/fixtures/get_volume_source_mount_from_configmap.json new file mode 100644 index 000000000..4a2e2cb19 --- /dev/null +++ b/pkg/splunk/enterprise/testdata/fixtures/get_volume_source_mount_from_configmap.json @@ -0,0 +1,23 @@ +{ + "configMap": { + "name": "testConfgMap", + "items": [ + { + "key": "a", + "path": "a", + "mode": 755 + }, + { + "key": "b", + "path": "b", + "mode": 755 + }, + { + "key": "z", + "path": "z", + "mode": 755 + } + ], + "defaultMode": 755 + } +} diff --git a/pkg/splunk/enterprise/testdata/fixtures/quorum_lost_info.json b/pkg/splunk/enterprise/testdata/fixtures/quorum_lost_info.json new file mode 100644 index 000000000..640c0936e --- /dev/null +++ b/pkg/splunk/enterprise/testdata/fixtures/quorum_lost_info.json @@ -0,0 +1,27 @@ +{ + "entry": [ + { + "content": { + "initialized_flag": true, + "indexing_ready_flag": false, + "service_ready_flag": true, + "maintenance_mode": false, + "rolling_restart_flag": false, + "label": "splunk-manager1-cluster-manager-0", + "active_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7571-1583870198.bundle", + "checksum": "ABC123", + "timestamp": 1583870198 + }, + "latest_bundle": { + "bundle_path": "/opt/splunk/var/run/splunk/cluster/remote-bundle/506c58d5aeda1dd6017889e3186e7571-1583870198.bundle", + "checksum": "ABC123", + "timestamp": 1583870198 + }, + "multisite": "false", + "replication_factor": 3, + "site_replication_factor": "origin:2,total:3" + } + } + ] +}